import random

fn = input("Enter name:")
a, b = list(map(int, input("Size: ").split()))
min_v, max_v = list(map(int, input("Min and Max value: ").split()))
f = open(fn, 'w+')

for i in range(a):
    t = []
    for j in range(b):
        t.append(
            str(
                random.randint(min_v, max_v)
            )
        )
    f.write(" ".join(t) + '\n')
