Для ввода и вывода матрицы использовать файл.
пример (первая строка размер квадратной матрицы):
4
2 3 5 8
7 7 7 7
6 6 6 6
4 1 9 2
INPUT "vvedite nazvanie faila vvoda ", a$
OPEN a$ FOR INPUT AS #1
INPUT #1, n
DIM a(n, n)
FOR i = 1 TO n
FOR j = 1 TO n
INPUT #1, a(i, j)
NEXT
NEXT
CLOSE
PRINT "matrica"
FOR i = 1 TO n
FOR j = 1 TO n
PRINT a(i, j);
NEXT
PRINT
NEXT
INPUT "vvedite nazvanie faila vyvoda ", b$
OPEN b$ FOR OUTPUT AS #2
FOR i = 1 TO n
f = 0
FOR j = 1 TO n
FOR k = 1 TO n
IF a(i, j) <> a(i, k) THEN f = 1
NEXT
NEXT
IF f = 0 THEN PRINT #2, i
NEXT
CLOSE