#!/usr/bin/ruby
# -*- coding: utf-8 -*-

while (n = gets.to_i) && n != 0
  dice = {:top => 1, :north => 2, :east => 4,
          :west => 3, :south => 5, :bottom => 6}
  n.times do
    tmp = dice[:top]
    if (direct = gets.chomp) == "north"
      dice[:top] = dice[:south]
      dice[:south] = dice[:bottom]
      dice[:bottom] = dice[:north]
      dice[:north] = tmp
    elsif direct == "east"
      dice[:top] = dice[:west]
      dice[:west] = dice[:bottom]
      dice[:bottom] = dice[:east]
      dice[:east] = tmp
    elsif direct == "west"
      dice[:top] = dice[:east]
      dice[:east] = dice[:bottom]
      dice[:bottom] = dice[:west]
      dice[:west] = tmp
    else
      dice[:top] = dice[:north]
      dice[:north] = dice[:bottom]
      dice[:bottom] = dice[:south]
      dice[:south] = tmp
    end
  end
  puts dice[:top]
end
  