loop{
	n = gets.to_i
	break if n == 0
	top, north, west = 1, 2, 3
	n.times{
		case gets.chomp
		when 'north'
			top, north, west = 7-north, top, west
		when 'west'
			top, north, west = 7-west, north, top
		when 'east'
			top, north, west = west, north, 7-top
		when 'south'
			top, north, west = north, 7-top, west
		end
	}
	puts top
}