from collections import namedtuple

Test = namedtuple('Test', ['n', 'm', 'pcap', 'scap', 'slen', 'sdist', 'speed'])

nums = list(map(int, open('amusement.in').read().split()))

def r():
    global nums
    res = nums[0]
    nums = nums[1:]
    return res

while nums:
    n = r()
    m = r()
    pcap = [r() for i in range(n - 2)]
    scap = [r() for i in range(n - 1)]
    slen = [r() for i in range(n - 1)]
    sdist = [r() for i in range(n - 1)]
    speed = [[r() for j in range(m)] for i in range(n - 1)]
    t = Test(n, m, pcap, scap, slen, sdist, speed)
    print(t)
