And for reference, incidentally, in case you ever forget what the point of some exercise was, I'll almost always comment the code up top with a quick sentence or two that reminds you what this program does.
Russia therefore has quite good relations with some countries that are democratic, and quite bad relations with some countries that are autocratic: it determines its policies on a case by case basis not through reference to some abstract ideological construct.