process.stdin.resume();
process.stdin.setEncoding('utf8');


process.stdin.on('data', function (chunk) {
    const n = chunk.toString() // 文字列化する
        .split("\n") // \nで分割
        .filter(x => x !== "");

    [...uniquenum] = n;
    let judge = [];
    let all = [];
    for (let y = 1; y <= 30; y++) {
        all.push(y);
    }
    const num = uniquenum.sort((a, b) => a - b)
    for (let i = 0; i < 30; i++) {
        if (num.some(item => item == all[i]) == false) {
            judge.push(all[i]);
        }
    }
    const ans = judge.sort((a, b) => a - b);
    console.log(ans[0]);
    console.log(ans[1]);
});
