def act1(row, col):
for x in range(1,row+1):
if x % 2 == 1:
first = '*'
second = '.'
else:
first = '.'
second = '*'
result = ''
net = first
for y in range(1,col+1):
result += net
if net == first:
net = second
else:
net = first
print(result)
cases = int(input())
for each in range(1,cases+1):
case = input()
act1(int(case[0]), int(case[2]))
if each < cases:
print()
The above code runs fine in pycharm and ideone but spoj gives runtime error. Help me find the mistakes.