n = int(eval(input()))

print((" ".join([str(x[1]) for x in sorted([(int(a), num) for a, num in zip(input().split(" "), list(range(1,n + 1)))])])))
print((" ".join([str(x[0]) for x in sorted([(num, int(a)) for num, a in zip(list(range(1,int(eval(input())) + 1)), input().split(" "))], key=lambda x: x[1],)])))
n = int(eval(input()))
print(
    (
        " ".join(
            [
                str(x[1])
                for x in sorted(
                    [
                        (int(a), num)
                        for a, num in zip(input().split(" "), list(range(1, n + 1)))
                    ]
                )
            ]
        )
    )
)

print(
    (
        " ".join(
            [
                str(x[0])
                for x in sorted(
                    [
                        (num, int(a))
                        for num, a in zip(
                            list(range(1, int(eval(input())) + 1)), input().split(" ")
                        )
                    ],
                    key=lambda x: x[1],
                )
            ]
        )
    )
)

-n = int(eval(input())) -                str(x[1]) +                str(x[0]) -                        (int(a), num) -                        for a, num in zip(input().split(" "), list(range(1, n + 1))) -                    ] +                        (num, int(a)) +                        for num, a in zip( +                            list(range(1, int(eval(input())) + 1)), input().split(" ") +                        ) +                    ], +                    key=lambda x: x[1],