import std.stdio;
import std.random;
import std.datetime;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

int rand(int M) {
    int ret = rndGen.front % M;
    rndGen.popFront;
    return ret;
}
 
void main() {
    int N; scanf("%d\n", &N);
    auto X = new char[][](N, N);
    foreach (i; 0 .. N) {
        foreach (j; 0 .. N) {
            char c; scanf("%c", &c);
            X[i][j] = c;
        }
    }
    struct P {
        int c;
        string s;
    }
    auto Y = new P[N];
    foreach (int i; 0 .. N) {
        Y[i].c = i;
        Y[i].s = cast(string)(X[i]);
    }
    Y.sort!"a.s.count('x') < b.s.count('x')";
    int M = cast(int)(Y[0].s.count('x'));
    rndGen.seed(Clock.currTime.second);
    //writeln(Y);
    int ai_prev;
    //writeln("M: ", M);
    if (M == 0) {
        foreach (i; 0 .. 1000) {
            writeln(Y[0].c + 1);
            fflush(std.c.stdio.stdout);
            scanf("%d", &ai_prev);
        }
    } else {
        foreach (i; 0 .. 1000) {
            writeln(Y[rand(N)].c + 1);
            fflush(std.c.stdio.stdout);
            scanf("%d", &ai_prev);
        }
    }
}