#include<iostream>
#include<string>

using namespace std;

void sort(int card[5])
{
	for(int i=0;i<5;i++)
	{
		int max=i;
		for(int j=i+1;j<5;j++)
		{
			if(card[max]<card[j])
			{
				max=j;
			}
		}
		int tmp=card[i];
		card[i]=card[max];
		card[max]=tmp;
	}
}

bool fourcard(int card[5])
{
	if((card[0]==card[1]&&card[1]==card[2]&&card[2]==card[3])||
		(card[1]==card[2]&&card[2]==card[3]&&card[3]==card[4]))
	{
		return true;
	}
	else
	{
		return false;
	}
}

bool fullhouse(int card[5])
{
	if((card[0]==card[1]&&card[2]==card[3]&&card[3]==card[4])||
		(card[0]==card[1]&&card[1]==card[2]&&card[3]==card[4]))
	{
		return true;
	}
	else
	{
		return false;
	}
}

bool straight(int card[5])
{
	if((card[0]-1==card[1]&&card[1]-1==card[2]&&card[2]-1==card[3]&&card[3]-1==card[4])||
		(card[0]==13&&card[1]==12&&card[2]==11&&card[3]==10&&card[4]==1))
	{
		return true;
	}
	else
	{
		return false;
	}
}

bool threecard(int card[5])
{
	if((card[0]==card[1]&&card[1]==card[2])||
		(card[1]==card[2]&&card[2]==card[3])||
		(card[2]==card[3]&&card[3]==card[4]))
	{
		return true;
	}
	else{
		return false;
	}
}

bool twopair(int card[5])
{
	if((card[0]==card[1]&&card[2]==card[3])||
		(card[0]==card[1]&&card[3]==card[4])||
		(card[1]==card[2]&&card[3]==card[4]))
	{
		return true;
	}
	else return false;
}

bool onepair(int card[5])
{
	if(card[0]==card[1]||
		card[1]==card[2]||
		card[2]==card[3]||
		card[3]==card[4])
	{
		return true;
	}
	else return false;
}

char *solve(int card[5])
{
	sort(card);
	if(fourcard(card))
	{
		return "four card";
	}
	else if(fullhouse(card))
	{
		return "full house";
	}
	else if(straight(card))
	{
		return "straight";
	}
	else if(threecard(card))
	{
		return "three card";
	}
	else if(twopair(card))
	{
		return "two pair";
	}
	else if(onepair(card))
	{
		return "one pair";
	}
	else
	{
		return "null";
	}
}

int main(void)
{
	int card[5];
	char c;
	while(cin>>card[0])
	{
		for(int i=1;i<5;i++)
		{
			cin>>c>>card[i];
		}
		cout<<solve(card)<<endl;
	}
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
constexpr int INF = 2e9 + 1;
int main() {
  int n, l, q;
  cin >> n;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  cin >> l >> q;
  vector<vector<int>> to(32, vector<int>(n, 0));
  x.emplace_back(INF);
  rep(i, n) {
    auto itr = lower_bound(x.begin(), x.end(), x[i] + l);
    if (*itr > x[i] + l) itr--;
    to[0][i] = itr - x.begin();
  }
  for (int i = 0; i < 31; i++) {
    for (int j = 0; j < n; j++) to[i + 1][j] = to[i][to[i][j]];
  }

  while (q--) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    if (a > b) swap(a, b);
    int res = 0;
    for (int i = 31; i >= 0; i--) {
      if (to[i][a] < b) {
        res += 1 << i;
        a = to[i][a];
      }
    }
    cout << res + 1 << endl;
  }
  return 0;
} 