#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;

const double PI=4*atan(1.0);
const int MAX_SIZE = 10000;

// àÏ
double dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
// OÏ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
// _cª¼üabãÉ é©È¢©
int is_point_on_line(P a, P b, P c) {
  return EQ( cross(b-a, c-a), 0.0 );
}
// 2¼üÌ¼s»è
int is_orthogonal(P a1, P a2, P b1, P b2) {
  return EQ( dot(a1-a2, b1-b2), 0.0 );
}
// 2¼üÌ½s»è
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}
// _a,bðÊé¼üÆ_cÌÔÌ£
double distance_l_p(P a, P b, P c) {
  return abs(cross(b-a, c-a)) / abs(b-a);
}
// _a,bð[_Æ·éüªÆ_cÆÌ£
double distance_ls_p(P a, P b, P c) {
  if ( dot(b-a, c-a) < EPS ) return abs(c-a);
  if ( dot(a-b, c-b) < EPS ) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð·»è
int is_intersected_ls(P a1, P a2, P b1, P b2) {
    // üªª½sÈêÍdÈÁÄ¢È¢±ÆÉ·é
    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 );
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð_vZ
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;
}
// a1,a2ðÊé¼üÆb1,b2ðÊé¼üÌð·»è
int is_intersected_l(P a1, P a2, P b1, P b2) {
  return !EQ( cross(a1-a2, b1-b2), 0.0 );
}
// a1,a2ðÊé¼üÆb1,b2ðÊé¼üÌð_vZ
P intersection_l(P a1, P a2, P b1, P b2) {
  P a = a2 - a1; P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}
/*
~üÆüªÌð·»è
*/
bool isCircleCrossLine(P a,P b,P c,double r){
	double d1 = abs(a-c);
	double d2 = abs(b-c);
    // üªªÉÜÜêéÆ«A±±ÌRgAEgðÍ¸¹Îtrue(ð·)ÆÈé
	//if(d1<r&&d2<r)
	//	return true;
	double d = distance_ls_p(a,b,c);
	return (EQ(d,r)||d<r);
}
// Op`ÌàÉ_ª é©Ç¤©
// OÏÌ³ª·×Ä¯¶ÈçàÉ_ è
bool isInTriangle(P p1,P p2,P p3,P s){
	P a=p1-s;
	P b=p2-s;
	P c=p3-s;
	return ((cross(a,b)>0&&cross(b,c)>0&&cross(c,a)>0)||(cross(a,b)<0&&cross(b,c)<0&&cross(c,a)<0));
}
// é`ÌÉ_ª¶Ý·é©Ç¤©
bool isInRectangle(P p1,P p2,P p3,P p4,P s){
	P a=p1-s;
	P b=p2-s;
	P c=p3-s;
    P d=p4-s;
	return ((cross(a,b)>0&&cross(b,c)>0&&cross(c,d)>0&&cross(d,a)>0)
        ||(cross(a,b)<0&&cross(b,c)<0&&cross(c,d)<0&&cross(d,a)<0));
}
// Op`ÌÊÏðÀW©çvZ
double calcAreaOfTriangle(P a,P b,P c){
	return abs((b.real()-a.real())*(c.imag()-a.imag()) - (c.real()-a.real())*(b.imag()-a.imag()))/2;
}
// ^¦çê½~ÌÍÍàÉ_ª¶Ý·é©Ç¤©
bool isContainingDot(P c,double r,P a){
	return (((c.real()-a.real())*(c.real()-a.real())
		+(c.imag()-a.imag())*(c.imag()-a.imag())<r*r)
		||EQ((c.real()-a.real())*(c.real()-a.real())
		+(c.imag()-a.imag())*(c.imag()-a.imag()),r*r));
}
// ½p`ÌÊÏö®
double calcPolygonArea(vector<P> p){
	double sum=0;
	for(int i = 0; i < p.size(); i++)
		sum+=cross(p[i],p[(i+1)%(p.size())]);
	return sum/2;
}
// 2xNgÔÌpx
// a©çbÖ¶üèÅ½x©(0->2*PI)
double diffAngle(P a,P b){
    double angle=atan2(cross(a,b),dot(a,b));
    if(angle<0)
        return 2*PI+angle;
    return angle;
}

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){
            // »Ýn_©çxNgÌûüÉTõð©¯AàÁÆàß¢¾Å½Ë
            // X^[gn_ÉßêéêÍAàÁÆàß¢¾æèX^[gn_ªß¯êÎS[
            // ÇÉÔÂ©Á½çI¹
            // »¤ÅÈ¯êÎTõp±
            double minMirrorDist=10000000.0;
            P nearMirror=P(-1,-1);
            bool isHor=false;
            int p=-1;
            // »ê¼êÌ¾ÉÎµÄNX·é©Ç¤©
            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){
                    // cross·éÈçAð_ðßÄ£ð`FbN
                    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;
            // startn_ª»ÝÌxNgãÉ é©Tõ
            if(!first&&is_point_on_line(cp,cp+ang,sp)){
                // àµ¾ÌÅZ£æèß¯êÎAS[µÄI¹
                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)){
                        // ÂêAð_ðvZµÄ»ÝÌêðXV
                        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;
                // ¶EÉLÑé¾Ìê
                if(isHor)
                    ang=P(ang.real(),-ang.imag());
                // ãº
                else
                    ang=P(-ang.real(),ang.imag());
            }
        }
    }

    return 0;
}

Measured memory_bytes: 0