#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
int is_point_on_line(P a, P b, P c) {
  return EQ( cross(b-a, c-a), 0.0 );
}
int is_intersected_ls(P a1, P a2, P b1, P b2) {
    if(abs(cross(a2-a1,b2-b1)) < EPS){
        return 0;
    }
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
        ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
P intersection_ls(P a1, P a2, P b1, P b2) {
  P b = b2-b1;
  double d1 = abs(cross(b, a1-b1));
  double d2 = abs(cross(b, a2-b1));
  double t = d1 / (d1 + d2);

  return a1 + (a2-a1) * t;
}


int main(){
    int n;
    vector<pair<P,P> > wall;
    wall.push_back(make_pair(P(0,0),P(0,8)));
    wall.push_back(make_pair(P(0,0),P(8,0)));
    wall.push_back(make_pair(P(8,8),P(0,8)));
    wall.push_back(make_pair(P(8,8),P(8,0)));
    while(cin>>n&&n>=0){
        vector<pair<P,P> > mirror;
        for(int i = 0; i < n; i++){
            char a;
            int x,y;
            cin>>a>>x>>y;
            if(a=='x')
                mirror.push_back(make_pair(P(x,y),P(x+1,y)));
            else
                mirror.push_back(make_pair(P(x,y),P(x,y+1)));
        }
        const P sp=P(0.75,0.25);
        P ang=P(1,1);
        P cp=sp;
        bool first=true;
        int prvMatchMirror=-1;
        while(1){
            double minMirrorDist=10000000.0;
            P nearMirror=P(-1,-1);
            bool isHor=false;
            int p=-1;
            for(int i = 0; i < n; i++){
                P tmp=ang;
                tmp*=100;
                if(is_intersected_ls(cp,cp+tmp,mirror[i].first,mirror[i].second)
                    &&prvMatchMirror!=i){
                    P crossPoint=intersection_ls(cp,cp+tmp,mirror[i].first,mirror[i].second);
                    double d=abs(crossPoint-cp);
                    if(minMirrorDist>d){
                        minMirrorDist=d;
                        nearMirror=crossPoint;
                        isHor=(EQ(mirror[i].first.imag()-mirror[i].second.imag(),0));
                        p=i;
                    }
                }
            }
            prvMatchMirror=p;
            if(!first&&is_point_on_line(cp,cp+ang,sp)){
                double d=abs(cp-sp);
                if(d<minMirrorDist){
                    printf("%d %d\n",(int)(EPS+100*sp.real()),(int)(EPS+100*sp.imag()));
                    break;
                }
            }
            first=false;
            if(EQ(nearMirror.real(),-1)){
                for(int i = 0; i < wall.size(); i++){
                    P tmp=ang;
                    tmp*=100;
                    if(is_intersected_ls(cp,cp+tmp,wall[i].first,wall[i].second)){
                        P crossPoint=intersection_ls(cp,cp+tmp,wall[i].first,wall[i].second);
                        if(EQV(crossPoint,cp))
                            continue;
                        cp=crossPoint;
                        printf("%d %d\n",(int)(100*cp.real()+EPS),(int)(100*cp.imag()+EPS));
                        break;
                    }
                }
                break;
            }
            else{
                cp=nearMirror;
                if(isHor)
                    ang=P(ang.real(),-ang.imag());
                else
                    ang=P(-ang.real(),ang.imag());
            }
        }
    }
    return 0;
}

Measured memory_bytes: 0