#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

void solve(int n,int m){
  int a,b;
  bool p[n+5][n+5],ans[n+5];
  rep(i,n+5)rep(j,n+5){p[i][j]=ans[j]=false;}
  rep(i,m){
    cin>>a>>b;
    p[a][b]=p[b][a]=true;
  }
  REP(i,1,n+1){
    REP(j,1,n+1){
      ans[i]+=p[1][i];
      if(p[1][i]==true&&p[i][j]==true)ans[j]=true;
    }
  }
  int cnt=0;
  REP(i,2,n+1)cnt+=ans[i];
  cout<<cnt<<endl;
}

int main(){
  int n,m;
  while(cin>>n>>m){
    if(n==0&&m==0)break;
    solve(n,m);
  }
  
  return 0;
}


#include <iostream>
#include <algorithm>
int main()
{
	int cs[5], i, j, t, r, fl, fl2;
	char c, s[8][11] = {"null", "one pair", "two pair", "three card", "straight", "full house", "four card"};
	while (std::cin >> cs[0] >> c >> cs[1] >> c >> cs[2] >> c >> cs[3] >> c >> cs[4])
	{
		r = 1;
		std::sort(cs, cs+5);
		int n[13] = {0};
		for (i = 0; i < 5; i++)
			n[cs[i]-1]++;
		for (i = fl = t = 0; i < 13; i++)
			if (n[i] == 2)	t++;
		if (t == 1)	r = 2;
		if (t == 2)	r = 3;
		for (i = fl = 0; i < 13 && !fl; i++)
			if (n[i] == 3)		r = 4, fl = 1;
			else if (n[i] == 4)	r = 7, fl = 1;
		for (i = fl = 0; i < 9 && !fl; i++)
		{
			for (j = 0, fl2 = 1; j < 5 && fl2; j++)
				if (n[i+j] != 1)	fl2 = 0;
			if (fl2)	r = 5, fl2 = 1;
		}
		if (!fl)
		{
			for (i = 9, fl = 0; i < 13 && !fl; i++)
				if (n[i] != 1)	fl = 1;
			if (!fl && n[0])	r = 5;
		}
		for (i = fl = fl2 = 0; i < 13; i++)
		{
			if (n[i] == 2)	fl = 1;
			if (n[i] == 3)	fl2 = 1;
		}
		if (fl && fl2)	r = 6;
		std::cout << s[r-1] << std::endl;
	}
}