#include<iostream>
#include<queue>
#include<cstdio>
using namespace std;

int main(){
	priority_queue<int,vector<int>,greater<int> > que;
	string ss;
	int c[5];
	while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF){
		int dt[14];
		for(int i=0;i<14;i++){
			dt[i]=0;
		}
		for(int i=0;i<5;i++){
			que.push(c[i]);
		}
		while(!que.empty()){
			for(int i=1;i<=13;i++){
				if(que.top()==i)dt[i]++;
			}
			que.pop();
		}
		int onepair=0,threecard=0,straight=0,fourcard=0;
		for(int i=1;i<14;i++){
			if(dt[i]==2)onepair++;
			if(dt[i]==3)threecard++;
			if(dt[i]==4)fourcard++;
		}
		for(int i=5;i<14;i++){
			if(dt[i-4]==1 && dt[i-3]==1 && dt[i-2]==1 && dt[i-1]==1 &&dt[i]==1)straight++;
			if(i==13){
				if(dt[10]==1 && dt[11]==1 && dt[12]==1 && dt[13]==1 &&dt[1]==1)straight++;
			}
		}
		if(onepair==1){
			if(threecard==1)cout<<"full house"<<endl;
			else cout<<"one pair"<<endl;
		}
		else if(onepair==2)cout<<"two pair"<<endl;
		else if(threecard==1){
			if(onepair==1)cout<<"full house"<<endl;
			else cout<<"three card"<<endl;
		}
		else if(fourcard==1)cout<<"four card"<<endl;
		else if(straight==1)cout<<"straight"<<endl;
		else cout<<"null"<<endl;
	}
	return 0;
}
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e5 + 5, M = 4 * N + 5;

int head[N], nxt[M], to[M], typ[M], ne, n;

void init(){
    ne = 0;
    memset(head, -1, n * sizeof head[0]);
}

void addEdge(int f, int t, int ty){
    to[ne] = t;
    typ[ne] = ty;
    nxt[ne] = head[f];
    head[f] = ne++;
}

void addBiEdge(int a, int b, int ty){
    addEdge(a, b, ty);
    addEdge(b, a, ty);
}

struct state{
    int dis;
    set<int> typs;
};

state node[N];

bool inQ[N];

int dij(){
    priority_queue<pair<int, int> , vector<pair<int, int>>, greater<pair<int, int>>> pq;
    pq.emplace(0, 0);

    for(int i = 0 ; i < n ; ++i)
        node[i].dis = (int)1e9;

    node[0].dis = 0;
    inQ[0] = true;

    int cst, v;

    while(pq.size()){
        auto top = pq.top();
        pq.pop();

        int u = top.second;
        int d = top.first;
        inQ[u] = false;


        if(node[u].dis < d)continue;

        for(int e = head[u] ; ~e ; e = nxt[e]){
            v = to[e];
            cst = (node[u].typs.find(typ[e]) == node[u].typs.end());

            if(node[u].dis + cst < node[v].dis){
                inQ[v] = true;
                node[v] = {node[u].dis + cst, {typ[e]}};
                pq.emplace(node[v].dis, v);
            }

            else if(node[u].dis + cst == node[v].dis){
                if(node[v].typs.find(typ[e]) != node[v].typs.end())continue;
                node[v].typs.emplace(typ[e]);
                if(!inQ[v])
                    pq.emplace(node[v].dis, v), inQ[v] = true;
            }
        }

    }

    if(node[n - 1].dis > n)
        node[n - 1].dis = -1;
    return node[n - 1].dis;
}

int main(){
    IO;
    int m;
    scanf("%d %d", &n, &m);
    init();
    while(m--){
        int u, v, ty;
        scanf("%d %d %d", &u, &v, &ty);
        addBiEdge(--u, --v, ty);
    }
    printf("%d\n", dij());
}