#include<iostream>using namespace std;class die{public: int top,bottom,left,right,front,back; die(); void east(); void west(); void north(); void south(); int getTop();};die::die(){ top = 1; back = 2; left = 3; right = 4; front = 5; bottom = 6;}void die::north(){ int tmp = top; top = front; front = bottom; bottom = back; back = tmp;}void die::south(){ int tmp = back; back = bottom; bottom = front; front = top; top = tmp;}void die::west(){ int tmp = top; top = right; right = bottom; bottom = left; left = tmp;}void die::east(){ int tmp = left; left = bottom; bottom = right; right = top; top = tmp;}int die::getTop(){ return top;}int main(){ int n; while(cin >> n) { if(n == 0) break; die myDie; while(n--) { string str; cin >> str; if(str == "east") myDie.east(); else if(str == "west") myDie.west(); else if(str == "north") myDie.north(); else if(str == "south") myDie.south(); } cout << myDie.getTop() << endl; } return 0;}