#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, s = 0;
  cin >> a;
  string c;
  for (int i = 0; i < a; i++) {
    cin >> c;
    if (c[c.size() - 2] == 'p' && c[c.size() - 1] == 'o') {
      cout << "FILIPINO" << endl;
    } else if (c[c.size() - 4] == 'd' && c[c.size() - 3] == 'e' &&
                   c[c.size() - 2] == 's' && c[c.size() - 1] == 'u' ||
               c[c.size() - 4] == 'm' && c[c.size() - 3] == 'a' &&
                   c[c.size() - 2] == 's' && c[c.size() - 1] == 'u') {
      cout << "JAPANESE" << endl;
    } else if (c[c.size() - 5] == 'm' && c[c.size() - 4] == 'n' &&
               c[c.size() - 3] == 'i' && c[c.size() - 2] == 'd' &&
               c[c.size() - 1] == 'a') {
      cout << "KOREAN" << endl;
    }
  }
  return 0;
}
