#include using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define loop for(;;) #define trace(var) cerr<<">>> "<<#var<<" = "< inline ostream& operator<<(ostream&os, pair p) { return os << '(' << p.first << ", " << p.second << ')'; } template inline ostream& operator<<(ostream&os, tuple t) { return os << '(' << get<0>(t) << ", " << get<1>(t) << ", " << get<2>(t) << ')'; } template inline ostream& operator<<(ostream&os, vector v) { if (v.size() == 0) { return os << "(empty)"; } os << v[0]; for (int i=1, len=v.size(); i inline istream& operator>>(istream&is, vector&v) { rep (i, v.size()) is >> v[i]; return is; } // ^ > v < int dx[] = { -1, 0, 1, 0 }; int dy[] = { 0, 1, 0, -1 }; typedef vector vi; int memo[20]; bool fourcard(vi&xs) { rep (i, 20) if (memo[i] == 4) return true; } bool fullhouse(vi&xs) { bool a = false, b = false; rep (i, 20) if (memo[i] == 2) a = true; else if (memo[i] == 3) b = true; return a and b; } bool three(vi&xs) { rep (i, 20) if (memo[i] == 3) return true; } bool two(vi&xs) { int m = 0; rep (i,20) if (memo[i] == 2) ++m; return m == 2; } bool one(vi&xs) { int m = 0; rep (i,20) if (memo[i] == 2) ++m; return m == 1; } int main() { cin.tie(0); ios::sync_with_stdio(0); cout.setf(ios::fixed); cout.precision(10); int a,b,c,d,e; while (cin>>a >>b >>c >>d >>e) { vi xs = {a,b,c,d,e}; rep (i, 20) memo[i] = 0; for (int x: xs) memo[x]++; if (fourcard(xs)) { cout << "FOUR CARD" << endl; } else if (fullhouse(xs)) { cout << "FULL HOUSE" << endl; } else if (three(xs)) { cout << "THREE CARD" << endl; } else if (two(xs)) { cout << "TWO PAIR" << endl; } else if (one(xs)) { cout << "ONE PAIR" << endl; } else { cout << "NO HAND" << endl; } break; } return 0; }