#include<iostream>
#include<map>
#include<vector>
using namespace std;

int main(){
    map<string, vector<int>> m;
    m["north"] = vector<int>({1, 0, 4, 5});
    m["south"] = vector<int>({5, 4, 0, 1});
    m["east"] = vector<int>({3, 0, 2, 5});
    m["west"] = vector<int>({5, 2, 0, 3});

    int n;
    while(cin >> n, n){
        int a[6] = {1, 2, 3, 4, 5, 6};
        while(n-- > 0){
            string s;   cin >> s;
            int cp = a[m[s][0]];
            for(int i = 0; i < 3; i++)  a[m[s][i]] = a[m[s][i+1]];
            a[m[s][3]] = cp;
        }
        cout << a[0] << endl;
    }
    return 0;
}
