#!/bin/bash

for t in $(seq 46 60); do
    newt=$((t + 15))

    in="task${t}.in"
    out="task${t}.out"
    new="task${newt}.in"

    awk '
    NR == FNR {
        ans[FNR] = $1
        next
    }

    FNR == 1 {
        print $1, $2, 1
        next
    }

    FNR == 2 {
        print
        next
    }

    {
        idx = FNR - 2
        prev = (idx == 1 ? 0 : ans[idx - 1])

        print ($1 ^ prev), ($2 ^ prev)
    }
    ' "$out" "$in" > "$new"

    echo "Created $new"
done
