#include <bits/stdc++.h>
using namespace std;
int stack[100];
int pop();
void display();
int top();
int TOP = -1;
int n;
int ara[101];
int total = 0;
int dp[101][50002];
int Strlen(char str[]) {
  int len = 0;
  for (int i = 0; str[i] != '\0'; i++) {
    len++;
  }
  return len;
}
int main() {
  int tc;
  scanf("%d", &tc);
  for (int tr = 1; tr <= tc; tr++) {
    char str[1005];
    scanf(" %s", str);
    int l = Strlen(str);
    if (str[l - 1] == 'o' && str[l - 2] == 'p') {
      printf("FILIPINO\n");
    } else if (str[l - 1] == 'u' && str[l - 2] == 's' && str[l - 3] == 'e' &&
               str[l - 4] == 'd') {
      printf("JAPANESE\n");
    } else if (str[l - 1] == 'u' && str[l - 2] == 's' && str[l - 3] == 'a' &&
               str[l - 4] == 'm') {
      printf("JAPANESE\n");
    } else if (str[l - 1] == 'a' && str[l - 2] == 'd' && str[l - 3] == 'i' &&
               str[l - 4] == 'n' && str[l - 5] == 'm') {
      printf("KOREAN\n");
    } else {
      printf("FILIPINO\n");
    }
  }
}
