#49956: python 解


VV1071311 (1071311)


ans=''
while 1:
    turn=int(input())
    if turn==0:
        break
    t,n,w=1,2,3
    for i in range(turn):
        command=input()
        if command=='north':
            t,n,w=7-n,t,w
        elif command=='west':
            t,n,w=7-w,n,t
        elif command=='east':
            t,n,w=w,n,7-t
        else:
            t,n,w=n,7-t,w
    print(t)
#49957: Re: python 解


VV1071311 (1071311)


while 1:
    turn=int(input())
    if turn==0:
        break
    t,n,w=1,2,3
    for i in range(turn):
        command=input()
        if command=='north':
            t,n,w=7-n,t,w
        elif command=='west':
            t,n,w=7-w,n,t
        elif command=='east':
            t,n,w=w,n,7-t
        else:
            t,n,w=n,7-t,w
    print(t)