#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = 1000, mod = 1000000007, M = 2e9;
const long long MAX = 5e18;
int T;
string ans[200], s;
int main() {
  cin >> T;
  ans['o'] = "FILIPINO";
  ans['u'] = "JAPANESE";
  ans['a'] = "KOREAN";
  while (T--) {
    cin >> s;
    cout << ans[s.back()] << '\n';
  }
  return 0;
}
