Problem p02629 (python)

Fixed submission:
n = int(input())
a = ''

while n > 0:
    if n%26 == 1:
        a += 'a'
    elif n%26 == 2:
        a += 'b'
    elif n%26 == 3:
        a += 'c'
    elif n%26 == 4:
        a += 'd'
    elif n%26 == 5:
        a += 'e'
    elif n%26 == 6:
        a += 'f'
    elif n%26 == 7:
        a += 'g'
    elif n%26 == 8:
        a += 'h'
    elif n%26 == 9:
        a += 'i'
    elif n%26 == 10:
        a += 'j'
    elif n%26 == 11:
        a += 'k'
    elif n%26 == 12:
        a += 'l'
    elif n%26 == 13:
        a += 'm'
    elif n%26 == 14:
        a += 'n'
    elif n%26 == 15:
        a += 'o'
    elif n%26 == 16:
        a += 'p'
    elif n%26 == 17:
        a += 'q'
    elif n%26 == 18:
        a += 'r'
    elif n%26 == 19:
        a += 's'
    elif n%26 == 20:
        a += 't'
    elif n%26 == 21:
        a += 'u'
    elif n%26 == 22:
        a += 'v'
    elif n%26 == 23:
        a += 'w'
    elif n%26 == 24:
        a += 'x'
    elif n%26 == 25:
        a += 'y'
    elif n%26 == 0:
        a += 'z'
        n -=26
    n = int(n / 26)
a = a[::-1]
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = ''
 
if n == 1:
    print('a')
if n == 26:
    print('z')
else:
    while n > 0:
    	if n%26 == 1:
        	a += 'a'
    	elif n%26 == 2:
        	a += 'b'
    	elif n%26 == 3:
        	a += 'c'
    	elif n%26 == 4:
        	a += 'd'
    	elif n%26 == 5:
        	a += 'e'
    	elif n%26 == 6:
        	a += 'f'
    	elif n%26 == 7:
        	a += 'g'
    	elif n%26 == 8:
        	a += 'h'
    	elif n%26 == 9:
        	a += 'i'
    	elif n%26 == 10:
        	a += 'j'
    	elif n%26 == 11:
        	a += 'k'
    	elif n%26 == 12:
        	a += 'l'
    	elif n%26 == 13:
        	a += 'm'
    	elif n%26 == 14:
        	a += 'n'
    	elif n%26 == 15:
        	a += 'o'
    	elif n%26 == 16:
        	a += 'p'
    	elif n%26 == 17:
        	a += 'q'
    	elif n%26 == 18:
        	a += 'r'
    	elif n%26 == 19:
        	a += 's'
    	elif n%26 == 20:
        	a += 't'
    	elif n%26 == 21:
        	a += 'u'
    	elif n%26 == 22:
        	a += 'v'
    	elif n%26 == 23:
        	a += 'w'
    	elif n%26 == 24:
        	a += 'x'
    	elif n%26 == 25:
        	a += 'y'
    	elif n%26 == 0:
        	a += 'z'
        	n -=26
    	n = int(n / 26)
	a = a[::-1]
	print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = ''

if n == 1:
    print('a')
if n == 26:
    print('z')
else:
    while n > 0:
    	if n%26 == 1:
        	a += 'a'
    	elif n%26 == 2:
        	a += 'b'
    	elif n%26 == 3:
        	a += 'c'
    	elif n%26 == 4:
        	a += 'd'
    	elif n%26 == 5:
        	a += 'e'
    	elif n%26 == 6:
        	a += 'f'
    	elif n%26 == 7:
        	a += 'g'
    	elif n%26 == 8:
        	a += 'h'
    	elif n%26 == 9:
        	a += 'i'
    	elif n%26 == 10:
        	a += 'j'
    	elif n%26 == 11:
        	a += 'k'
    	elif n%26 == 12:
        	a += 'l'
    	elif n%26 == 13:
        	a += 'm'
    	elif n%26 == 14:
        	a += 'n'
    	elif n%26 == 15:
        	a += 'o'
    	elif n%26 == 16:
        	a += 'p'
    	elif n%26 == 17:
        	a += 'q'
    	elif n%26 == 18:
        	a += 'r'
    	elif n%26 == 19:
        	a += 's'
    	elif n%26 == 20:
        	a += 't'
    	elif n%26 == 21:
        	a += 'u'
    	elif n%26 == 22:
        	a += 'v'
    	elif n%26 == 23:
        	a += 'w'
    	elif n%26 == 24:
        	a += 'x'
    	elif n%26 == 25:
        	a += 'y'
    	elif n%26 == 0:
        	a += 'z'
        	n -=26
    	n = int(n / 26)
	a = a[::-1]
	print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = ''

if n == 1:
    print('a')
if n == 26:
    print('z')
else:
    while n > 0:
    if n%26 == 1:
        a += 'a'
    elif n%26 == 2:
        a += 'b'
    elif n%26 == 3:
        a += 'c'
    elif n%26 == 4:
        a += 'd'
    elif n%26 == 5:
        a += 'e'
    elif n%26 == 6:
        a += 'f'
    elif n%26 == 7:
        a += 'g'
    elif n%26 == 8:
        a += 'h'
    elif n%26 == 9:
        a += 'i'
    elif n%26 == 10:
        a += 'j'
    elif n%26 == 11:
        a += 'k'
    elif n%26 == 12:
        a += 'l'
    elif n%26 == 13:
        a += 'm'
    elif n%26 == 14:
        a += 'n'
    elif n%26 == 15:
        a += 'o'
    elif n%26 == 16:
        a += 'p'
    elif n%26 == 17:
        a += 'q'
    elif n%26 == 18:
        a += 'r'
    elif n%26 == 19:
        a += 's'
    elif n%26 == 20:
        a += 't'
    elif n%26 == 21:
        a += 'u'
    elif n%26 == 22:
        a += 'v'
    elif n%26 == 23:
        a += 'w'
    elif n%26 == 24:
        a += 'x'
    elif n%26 == 25:
        a += 'y'
    elif n%26 == 0:
        a += 'z'
        n -=26
    n = int(n / 26)
a = a[::-1]
print(a)