#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
long long MOD = 1e9 + 7;
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  if (s.substr(n - 2, 2) == "po") {
    cout << "FILIPINO\n";
  } else if (s.substr(n - 4, 4) == "desu" || s.substr(n - 4, 4) == "masu") {
    cout << "JAPANESE\n";
  } else {
    cout << "KOREAN\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    solve();
  }
  return 0;
}
