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