n = gets.to_i output = "" n += 1 while n > 0 n -= 1 output = (n % 26 + "A".ord).chr + output n /= 26 end puts output