class Dice
  attr_reader :top, :north, :west

  def initialize
    @top = 1
    @north = 2
    @west = 3
  end

  def tumble(s)
    if s == "north"
      self.n
    elsif s == "east"
      self.e
    elsif s == "west"
      self.w
    elsif s == "south"
      self.s
    end
  end

  def change(top, north, west)
    @top, @north, @west = top, north, west
  end

  def n
    change(7-@north, @top, @west)
  end

  def e
    change(@west, @north, 7-@top)
  end

  def w
    change(7-@west, @north, @top)
  end

  def s
    change(@north, 7-@top, @west)
  end
end

while (n = gets.to_i) != 0 do
  die = Dice.new
  n.times do
    die.tumble(gets.chomp)
  end
  puts die.top
end