#include <bits/stdc++.h>
using namespace std;
const bool testcases = 1;
long long int seed;
auto random_address = [] {
  char *p = new char;
  delete p;
  return (uint64_t)p;
};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count() *
            (random_address() | 1));
inline int rnd(int l = 0, int r = INT_MAX) {
  return uniform_int_distribution<int>(l, r)(rng);
}
template <typename T>
bool isPrime(T n) {
  for (T i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
template <typename T>
inline bool in_range(T a, T l, T r) {
  return (a >= l && a <= r);
}
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
  for (auto &x : a) in >> x;
  return in;
}
template <typename TAIL>
inline void inp(TAIL &T) {
  cin >> T;
}
template <typename HEAD, typename... TAIL>
inline void inp(HEAD &H, TAIL &...T) {
  cin >> H;
  inp(T...);
}
int main() {
  std::chrono::time_point<std::chrono::high_resolution_clock> start_time,
      end_time;
  start_time = std::chrono::high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  int __T__ = 1;
  if (testcases) cin >> __T__;
  while (__T__--) {
    s.clear();
    cin >> s;
    int n = s.length();
    if (s[n - 1] == 'o')
      puts("FILIPINO");
    else if (s[n - 1] == 'u')
      puts("JAPANESE");
    else
      puts("KOREAN");
    108;
  }
  end_time = std::chrono::high_resolution_clock::now();
  long long int elapsed_time =
      std::chrono::duration_cast<std::chrono::milliseconds>(end_time -
                                                            start_time)
          .count();
  42;
  if (elapsed_time < 10000)
    42;
  else
    42;
  return 0;
}
