#include <bits/stdc++.h>
using namespace std;
const string alf = "abcdefghijklmnopqrstuvwxyz";
const int hashP = 239017;
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const int INF = 1e9;
const long long INF2 = 1e18;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    string s;
    cin >> s;
    if (s.size() >= 5) {
      if (s[s.size() - 1] == 'a' && s[s.size() - 2] == 'd' &&
          s[s.size() - 3] == 'i' && s[s.size() - 4] == 'n' &&
          s[s.size() - 5] == 'm') {
        cout << "KOREAN\n";
      } else if (s[s.size() - 1] == 'u' && s[s.size() - 2] == 's' &&
                     s[s.size() - 3] == 'a' && s[s.size() - 4] == 'm' ||
                 s[s.size() - 1] == 'u' && s[s.size() - 2] == 's' &&
                     s[s.size() - 3] == 'e' && s[s.size() - 4] == 'd') {
        cout << "JAPANESE\n";
      } else {
        cout << "FILIPINO\n";
      }
    } else {
      if (s.size() >= 4) {
        if (s[s.size() - 1] == 'u' && s[s.size() - 2] == 's' &&
                s[s.size() - 3] == 'a' && s[s.size() - 4] == 'm' ||
            s[s.size() - 1] == 'u' && s[s.size() - 2] == 's' &&
                s[s.size() - 3] == 'e' && s[s.size() - 4] == 'd') {
          cout << "JAPANESE\n";
        } else {
          cout << "FILIPINO\n";
        }
      } else {
        cout << "FILIPINO\n";
      }
    }
  }
  return 0;
}
