#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  string b;
  cin >> a;
  for (int i = 0; i < a; i++) {
    cin >> b;
    int c = b.size();
    if ((b[c - 1] == 'u' && b[c - 2] == 's' && b[c - 3] == 'e' &&
         b[c - 4] == 'd') ||
        (b[c - 1] == 'u' && b[c - 2] == 's' && b[c - 3] == 'a' &&
         b[c - 4] == 'm'))
      cout << "JAPANESE" << endl;
    else if (b[c - 1] == 'a' && b[c - 2] == 'd' && b[c - 3] == 'i' &&
             b[c - 4] == 'n' && b[c - 5] == 'm')
      cout << "KOREAN" << endl;
    else if (b[c - 1] == 'o' && b[c - 2] == 'p')
      cout << "FILIPINO" << endl;
  }
  return 0;
}
