#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed;
  cout.precision(10);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int len = s.length();
    if (s[len - 1] == 'o')
      cout << "FILIPINO"
           << "\n";
    else if (s[len - 1] == 'u')
      cout << "JAPANESE"
           << "\n";
    else if (s[len - 1] == 'a')
      cout << "KOREAN"
           << "\n";
  }
  return 0;
}
