#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll N,M;
ll d[301][301];
bool used[301];
ll Start[301];

ll Solve(ll x){
    if(!used[d[x][Start[x]]]) return d[x][Start[x]];
    Start[x]++;
    return Solve(x);
}

ll SOLVE(){
    vec kari(M+1,0);
    rep(i,N) kari[Solve(i)]++;
    ll MAX=-INF, basho=-1;
    rep(i,M) if(kari[i]>MAX){
        MAX=kari[i];
        basho=i;
    }
    //rep(i,M) cout<<kari[i]<<' ';
    //cout<<endl;
    //cout<<MAX<<' '<<basho+1<<endl;
    used[basho]=true;
    return MAX;
}
ll MAIN(){
    if(M==1) return N;
    ll ret=INF;
    rep(i,M-1) {
        //cout<<i<<':';
        ll K=SOLVE();
        ret=min(ret,K);
    }
    return ret;
}
int main(){
    cin>>N>>M;
    rep(i,N) rep(j,M) {cin>>d[i][j]; d[i][j]--;}
    cout<<MAIN()<<endl;

}
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef vector <int> vi;
typedef vector <string> vs;
#define N1 5
#define N2 13
int main(void){
	vi card(N2);
	string prize[7]={"null","one pair","two pair","three card","straight","full house","four card"};
	while (true){
		for (int i=0; i<N2; i++)
			card[i]=0;
		int a=0, b=0, d=N2, p=0,tmp;
		for (int i=0;i<N1;i++){
			char c;
			if (i!=0) cin>>c;
			cin>>tmp;
			if (cin.eof()) break;
			tmp--;
			if (tmp<d) d=tmp;
			if (card[tmp]==0) b++;
			card[tmp]++;
			if (card[tmp]>a) a=card[tmp];
		}
		if (b==0) break;
		switch (b){
		case 2: 
			if (a==4) p=6;
			else p=5;
			break;
		case 3:
			if (a==3) p=3;
			else p=2;
			break;
		case 4:
			p=1;
			break;
		case 5:
			bool f=true;
			for (int i=d; i<d+N1; i++)
				if (card[i]!=1){
					f=false;
					break;
				}
			if (!f && card[0]==1){
				f=true;
				for (int i=9; i<N2; i++)
					if (card[i]!=1){
						f=false;
						break;
					}
			}
			if (f) p=4;
			else p=0;
		}
		cout<<prize[p]<<endl;
	}
}