#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main(){ ll n; cin >> n; bool bo[10]; for(int i = 0;i < 10;i++)bo[i] = true; for(int i = 0;i < n;i++){ ll a,b,c,d; cin >> a >> b >> c >> d; string s; cin >> s; if(s[0] == 'N')bo[a] = false,bo[b] = false,bo[c] = false,bo[d] = false; } for(int i = 0;i < 10;i++){ if(bo[i])cout << i << endl; } }