#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr ll mod = 1e9 + 7;
inline void solve() {
  string str;
  cin >> str;
  if (string(str.end() - 2, str.end()) == "po")
    cout << "FILIPINO\n";
  else if (string(str.end() - 4, str.end()) == "desu" ||
           string(str.end() - 4, str.end()) == "masu")
    cout << "JAPANESE\n";
  else
    cout << "KOREAN\n";
}
int main() {
  cin.tie(nullptr), cout.tie(nullptr), ios::sync_with_stdio(false);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; ++i) solve();
}
