public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            if (br.readLine().isEmpty()) {
                break;
            }
            else System.out.println(CatFactory.getCatByKey(br.readLine()));
        }
    }
Спасибо.