The first time my code loops through my nested while loop it works. But the second time it doesn't- I don't know why. Could someone tell me the reason.

```
m = [['__', '__', '__'],['__', '__', '__'],['__', '__', '__']]
z=1
count=9
f=[0,2]
from random import choice
w=choice(f)
from random import choice
t=choice(f)
i=[0,1,2]
print "Please insert an X or O into a coordinate point. (Top-left corner is (0,0) and bottom-right corner is (2,2)"
print m
d=raw_input("Would you like to go first? (Y/N) ")
if (d == 'N'):
for q in range(3):
for r in range(3):
if (m[q][r]=='__'):
if (m[w][t]=='__'):
m[w][t]='X'
print m
print "doda"
while (z > 0):
a=input("Please insert a row coordinate ")
b=input("Please insert a column coordinate ")
while (m[a][b]!='__'):
print "Please select another cordinate pair"
a=input("Please insert a row coordinate ")
b=input("Please insert a column coordinate ")
if (m[a][b]=='__'):
m[a][b]='O'
print m
g=1
while g== 1:
if (a == 0 or a == 2):
if (b == 0 or b == 2):
#range of values only corner can have-either 0 or 2
from random import choice
w=choice(f)
from random import choice
t=choice(f)
while (m[w][t]!='__'):
from random import choice
w=choice(f)
from random import choice
t=choice(f)
if (m[w][t]=='__'):
m[w][t]='X'
print m
count=count-1
print count
g=-1
print g
```