#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  char s[1005];
  while (T--) {
    cin >> s;
    int l = strlen(s);
    switch (s[l - 1]) {
      case 'o':
        cout << "FILIPINO" << endl;
        break;
      case 'u':
        cout << "JAPANESE" << endl;
        break;
      case 'a':
        cout << "KOREAN" << endl;
        break;
    }
  }
  return 0;
}
