from itertools import chain
def insert_file(filename):
with open(filename, "w") as file:
matrix = []
for i in range(2):
row = []
for j in range(2):
row.append(raw_input())
matrix.append(row)
file.write("\n".join(chain(*matrix)))
def read_file(filename):
with open(filename, "r") as file:
matrix = []
for i in range(2):
row = []
for j in range(2):
row.append(int(file.readline().strip()))
matrix.append(row)
return matrix
insert_file("data.txt")
data = read_file("data.txt")
print(data)
ZnJvbSBpdGVydG9vbHMgaW1wb3J0IGNoYWluCgpkZWYgaW5zZXJ0X2ZpbGUoZmlsZW5hbWUpOgogICAgd2l0aCBvcGVuKGZpbGVuYW1lLCAidyIpIGFzIGZpbGU6CiAgICAgICAgbWF0cml4ID0gW10KICAgICAgICBmb3IgaSBpbiByYW5nZSgyKToKICAgICAgICAgICAgcm93ID0gW10KICAgICAgICAgICAgZm9yIGogaW4gcmFuZ2UoMik6CiAgICAgICAgICAgICAgICByb3cuYXBwZW5kKHJhd19pbnB1dCgpKQogICAgICAgICAgICBtYXRyaXguYXBwZW5kKHJvdykKICAgICAgICBmaWxlLndyaXRlKCJcbiIuam9pbihjaGFpbigqbWF0cml4KSkpCiAgICAgICAgCmRlZiByZWFkX2ZpbGUoZmlsZW5hbWUpOgogICAgd2l0aCBvcGVuKGZpbGVuYW1lLCAiciIpIGFzIGZpbGU6CiAgICAgICAgbWF0cml4ID0gW10KICAgICAgICBmb3IgaSBpbiByYW5nZSgyKToKICAgICAgICAgICAgcm93ID0gW10KICAgICAgICAgICAgZm9yIGogaW4gcmFuZ2UoMik6CiAgICAgICAgICAgICAgICByb3cuYXBwZW5kKGludChmaWxlLnJlYWRsaW5lKCkuc3RyaXAoKSkpCiAgICAgICAgICAgIG1hdHJpeC5hcHBlbmQocm93KQogICAgcmV0dXJuIG1hdHJpeAogICAgICAgIAppbnNlcnRfZmlsZSgiZGF0YS50eHQiKQpkYXRhID0gcmVhZF9maWxlKCJkYXRhLnR4dCIpCgpwcmludChkYXRhKQ==