#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int l = s.length();
    if (s[l - 1] == 'o')
      cout << "FILIPINO" << endl;
    else if (s[l - 1] == 'u')
      cout << "JAPANESE" << endl;
    else if (s[l - 1] == 'a')
      cout << "KOREAN" << endl;
  }
  return 0;
}
