The function f(x) seems to map the input countries to its neighboring countries. For example, Bulgaria maps to Romania, Spain maps to France, and South Korea maps to Japan.

