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