int input int for in input split for in range for in range for in rang

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
a = int(input())
A = [[int(j) for j in input().split()] for i in range(a)]
Q = [0] * a
for i in range(a):
Q[i] = [0] * a
for i in range(a):
for j in range(len(A[i])):
if (A[i][j] != 0):
Q[i][A[i][j]-1] = 1
for i in range (a):
for j in range (a):
print(Q[i][j] , end = ' ')
print()