# https://www.hackerrank.com/challenges/itertools-product/problem

import itertools

if __name__ == '__main__':
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    for i in itertools.product(A, B):
        print(i, end=' ')
    print()

d6e8884922de4b121c577cb8ca89db82109a2e7f
<mask token>

<mask token>
if __name__ == '__main__':
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    for i in itertools.product(A, B):
        print(i, end=' ')
    print()

import itertools
if __name__ == '__main__':
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    for i in itertools.product(A, B):
        print(i, end=' ')
    print()

# https://www.hackerrank.com/challenges/itertools-product/problem

import itertools

if __name__ == '__main__':
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    for i in itertools.product(A, B):
        print(i, end=' ')
    print()
