#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

typedef pair<int,int> paii;
typedef long long ll;

int n;

int solve(vector<int> cmd)
{	
	int dice[] = {1, 2, 3, 4, 5, 6};
	
	FOR(i, 0, n)
	{
		int swp;
		
		switch(cmd[i])
		{
			case 1:
				swp = dice[1];
				dice[1] = dice[0];
				dice[0] = dice[4];
				dice[4] = dice[5];
				dice[5] = swp;
				break;
			case 2:
				swp = dice[3];
				dice[3] = dice[0];
				dice[0] = dice[2];
				dice[2] = dice[5];
				dice[5] = swp;
				break;
			case 3:
				swp = dice[4];
				dice[4] = dice[0];
				dice[0] = dice[1];
				dice[1] = dice[5];
				dice[5] = swp;
				break;
			case 4:
				swp = dice[2];
				dice[2] = dice[0];
				dice[0] = dice[3];
				dice[3] = dice[5];
				dice[5] = swp;
				break;
		}
	}
	
	return dice[0];
}

int main()
{
	while(cin >> n, n)
	{
		vector<int> cmd;
		string str;
		
		FOR(i, 0 ,n)
		{
			cin >> str;		
			cmd.push_back(str == "north" ? 1 : (str == "east" ? 2 : (str == "south" ? 3 : 4)));
		}
		
		cout << solve(cmd) << endl;
	}
		
	return 0;
}