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