#include <bits/stdc++.h>
using namespace std;
string in;
int main() {
  int T = 0, temp = 0;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    cin >> in;
    temp = in.length();
    if (in[temp - 2] == 'p' && in[temp - 1] == 'o')
      cout << "FILIPINO" << endl;
    else if (in[temp - 2] == 's' && in[temp - 1] == 'u')
      cout << "JAPANESE" << endl;
    else if (in[temp - 2] == 'd' && in[temp - 1] == 'a')
      cout << "KOREAN" << endl;
  }
  return 0;
}
