#include #include using namespace std; int main() { while(1){ int num; cin >> num; if(num == 0) break; int top, nth, wst; top = 1; nth = 2; wst = 3; string cmd; for(int i=0; i> cmd; if(cmd == "north"){ buf = nth; nth = top; top = 7-buf; }else if(cmd == "west"){ buf = wst; wst = top; top = 7-buf; }else if(cmd == "south"){ buf = top; top = nth; nth = 7-buf; }else if(cmd == "east"){ buf = top; top = wst; wst = 7-buf; } } cout << top << endl; } return 0; }