#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int dy[] = {1, 1, -1, -1};
int dx[] = {1, -1, -1, 1};

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n < 0)
            return 0;

        vector<char> c(n);
        vector<int> ly(n), lx(n);
        for(int i=0; i<n; ++i)
            cin >> c[i] >> lx[i] >> ly[i];

        int y = 1;
        int x = 3;
        int d = 0;
        for(;;){
            y += dy[d];
            x += dx[d];

            bool isMirror = false;
            for(int i=0; i<n; ++i){
                if(c[i] == 'x'){
                    if(y == 4*ly[i] && 4*lx[i] <= x && x <= 4*(lx[i]+1)){
                        d ^= 3;
                        isMirror = true;
                    }
                }else{
                    if(x == 4*lx[i] && 4*ly[i] <= y && y <= 4*(ly[i]+1)){
                        d ^= 1;
                        isMirror = true;
                    }
                }
            }

            if(!isMirror && ((y == 1 && x == 3) || y == 0 || y == 32 || x == 0 || x == 32)){
                y *= 25;
                x *= 25;
                cout << x << ' ' << y << endl;
                break;
            }
        }
    }
}