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