#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[1007];
  int t;
  cin >> t;
  for (int tt = 1; tt <= t; tt++) {
    cin >> str;
    int n = strlen(str);
    if (str[n - 2] == 'p' && str[n - 1] == 'o')
      cout << "FILIPINO" << endl;
    else if (str[n - 5] == 'm' && str[n - 4] == 'n' && str[n - 3] == 'i' &&
             str[n - 2] == 'd' && str[n - 1] == 'a')
      cout << "KOREAN" << endl;
    else
      cout << "JAPANESE" << endl;
  }
  return 0;
}
