#include<bits/stdc++.h>
using namespace std;
main()
{
long n,cs=1;
while(cin>>n)
{
string s;
if(n==0)
break;
else
{
long up=1, down=6, north=2, south=5, west=3, east=4,extra;
while(n--)
{
cin>>s;
if(s=="north")
{
extra=up,up=south,south=down,down=north,north=extra;
}
else if(s=="south")
{
extra=up,up=north,north=down,down=south,south=extra;
}
else if(s=="east")
{
extra=up,up=west,west=down,down=east,east=extra;
}
else
extra=up,up=east,east=down,down=west,west=extra;
}
cout<<up<<endl;
}
}
}
using namespace std;
main()
{
long n,cs=1;
while(cin>>n)
{
string s;
if(n==0)
break;
else
{
long up=1, down=6, north=2, south=5, west=3, east=4,extra;
while(n--)
{
cin>>s;
if(s=="north")
{
extra=up,up=south,south=down,down=north,north=extra;
}
else if(s=="south")
{
extra=up,up=north,north=down,down=south,south=extra;
}
else if(s=="east")
{
extra=up,up=west,west=down,down=east,east=extra;
}
else
extra=up,up=east,east=down,down=west,west=extra;
}
cout<<up<<endl;
}
}
}