import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean a = (sc.next().charAt(0) == 'T'); boolean b = (sc.next().charAt(0) == 'T'); StringBuilder sb = new StringBuilder(); if (b) { sb.append("T"); } else { sb.append("F"); } sb.append(" "); if (a) { sb.append("T"); } else { sb.append("F"); } System.out.println(sb); } }