import java.util.Scanner; public class Test { public static void main(String[] args) { @SuppressWarnings("resource") Scanner input = new Scanner(System.in); while (input.hasNext()) { boolean flag = true; String s = input.nextLine(); String a[] = s.split("\."); if (s.equals("q")){ break; } if (s.length() < 7 || s.length() > 15 || a.length != 4 ) { System.out.println("N"); continue; } for (int i = 0; i < a.length; i++) { if (!a[i].matches("[0-9]{1,3}")) { flag = false; break; } if (Integer.valueOf(a[i]) >= 0 && Integer.valueOf(a[i]) <= 255) { flag = true; } else{ flag = false; break; } } if (flag) System.out.println("T"); else System.out.println("N"); } input.close(); } }