Die Game
while 1:
try:
a=[1,6,3,4,2,5]
T=input()
if T=='0':
break
for t in range(int(T)):
n=input()
tmp=a[0]
if n=='north':
a[0]=a[5]
a[5]=a[1]
a[1]=a[4]
a[4]=tmp
elif n=='south':
a[0]=a[4]
a[4]=a[1]
a[1]=a[5]
a[5]=tmp
elif n=='east':
a[0]=a[2]
a[2]=a[1]
a[1]=a[3]
a[3]=tmp
else:
a[0]=a[3]
a[3]=a[1]
a[1]=a[2]
a[2]=tmp
print(a[0])
except:
break