Design a system that takes big URLs like “http://www.geeksforgeeks.org/count-sum-of-digits-in-numbers-from-1-to-n/” and converts them into a short URL. It is given that URLs are stored in database and every URL has an associated integer id.  So your program should take an integer id and generate a URL.  
A URL character can be one of the following
	A lower case alphabet [‘a’ to ‘z’], total 26 characters
	An upper case alphabet [‘A’ to ‘Z’], total 26 characters
	A digit [‘0′ to ‘9’], total 10 characters
There are total 26 + 26 + 10 = 62 possible characters.
So the task is to convert an integer (database id) to a base 62 number where digits of 62 base are "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN
OPQRSTUVWXYZ0123456789"
Example 1:
Input: 
N = 12345
Output: 
dnh
12345
Explanation: "dnh" is the url for id 12345
Example 2:
Input: 
N = 30540
Output: 
h6K
30540
Explanation: "h6K" is the url for id 30540
Your Task:  
You don't need to read input or print anything. Your task is to complete the function idToShortURL() which takes the integer n as parameters and returns an string denoting the answer.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 10^{18}

Difficulty: MEDIUM
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
	def idToShortURL(self,n):
		# code here

Solutions:
class Solution:

	def idToShortURL(self, n):
		char_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		base = len(char_set)
		ans = []
		while n:
			(n, rem) = divmod(n, base)
			ans.append(char_set[rem])
		return ''.join(ans[::-1])


class Solution:

	def idToShortURL(self, n):
		k = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
		s = ''
		while n != 0:
			d = n % 62
			s = s + k[d]
			n = n // 62
		return s[::-1]


class Solution:

	def idToShortURL(self, n):
		ans = ''
		while n:
			rem = n % 62
			if rem >= 0 and rem <= 25:
				ans = chr(97 + rem) + ans
			elif rem >= 26 and rem <= 51:
				ans = chr(65 + (rem - 26)) + ans
			else:
				ans = chr(48 + (rem - 52)) + ans
			n = n // 62
		return ans


class Solution:

	def idToShortURL(self, n):
		a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		x = ''
		while n > 0:
			b = n % 62
			x += a[b]
			n = n // 62
		return x[::-1]


class Solution:

	def idToShortURL(self, n):
		c = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		r = ''
		while n > 0:
			b = n % 62
			r = r + c[b]
			n = n // 62
		return r[::-1]


class Solution:

	def idToShortURL(self, n):
		mp = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = []
		while n:
			(n, r) = divmod(n, 62)
			ans.append(mp[r])
		ans.reverse()
		return ''.join(ans)


class Solution:

	def idToShortURL(self, n):
		s = []
		while n:
			s.append(n % 62)
			n //= 62
		for i in range(len(s)):
			if s[i] < 26:
				s[i] = chr(s[i] + ord('a'))
			elif s[i] < 52:
				s[i] = chr(s[i] - 26 + ord('A'))
			else:
				s[i] = chr(s[i] - 52 + ord('0'))
		return ''.join(reversed(s))


class Solution:

	def idToShortURL(self, n):
		digits = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		result = ''
		while n > 0:
			remainder = n % 62
			result = digits[remainder] + result
			n //= 62
		return result


class Solution:

	def idToShortURL(self, n):
		map = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		short = ''
		while n > 0:
			short += map[n % 62]
			n //= 62
		return short[len(short)::-1]


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n != 0:
			r = n % 62
			ans += s[int(r)]
			n = n // 62
		return ans[::-1]


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		new_string = ''
		while n != 0:
			digit = n % 62
			new_string += s[digit]
			n = n // 62
		return new_string[::-1]


class Solution:

	def idToShortURL(self, n):
		s = ''
		x = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n > 0:
			s = s + x[n % 62]
			n //= 62
		return s[::-1]


class Solution:

	def idToShortURL(self, n):
		store = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		output = ''
		while n:
			output += store[n % 62]
			n = n // 62
		return output[::-1]


class Solution:

	def idToShortURL(self, n):
		st = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		data = ''
		while n:
			data = st[n % 62] + data
			n //= 62
		return data


class Solution:

	def idToShortURL(self, n):
		checker = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n > 0:
			res = n % 62
			n = n // 62
			ans += checker[res]
		return ans[::-1]


class Solution:

	def idToShortURL(self, n):
		code = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n:
			rem = n % 62
			ans = code[rem] + ans
			n = n // 62
		return ans


class Solution:

	def idToShortURL(self, n):
		g = ''
		a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n > 0:
			i = n % 62
			n = n // 62
			g = a[i] + g
		return g


class Solution:

	def idToShortURL(self, n):
		url = ''
		a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n > 0:
			url += a[n % 62]
			n = n // 62
		return url[::-1]


class Solution:

	def idToShortURL(self, n):
		shorturl = ''
		d = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n:
			shorturl += d[n % 62]
			n = n // 62
		return shorturl[::-1]


class Solution:

	def idToShortURL(self, n):
		base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = []
		while n:
			ans.append(base[n % 62])
			n //= 62
		return ''.join(reversed(ans))


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		hash_val = ''
		while n > 0:
			hash_val = s[n % 62] + hash_val
			n //= 62
		return hash_val


class Solution:

	def idToShortURL(self, n):

		def base10tobase62(n):
			base62 = []
			while n > 0:
				base62.append(n % 62)
				n //= 62
			return base62[::-1]
		base62 = base10tobase62(n)
		Ans = ''
		for i in base62:
			if i < 26:
				Ans += chr(97 + i)
			elif i < 52:
				Ans += chr(65 + i - 26)
			else:
				Ans += str(i - 52)
		return Ans


class Solution:

	def idToShortURL(self, n):
		string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n:
			ans = ans + string[n % 62]
			n = n // 62
		return ans[::-1]


class Solution:

	def idToShortURL(self, n):
		num = int(n)
		s = ''
		str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n != 0:
			rem = n % 62
			s += str[rem]
			n = n // 62
		return s[::-1]


class Solution:

	def idToShortURL(self, n):
		mapper = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		url = ''
		while n > 0:
			url += mapper[n % 62]
			n = n // 62
		return url[len(url)::-1]


class Solution:

	def idToShortURL(self, n):
		map = list('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
		shorturl = ''
		while n:
			shorturl = shorturl + map[n % 62]
			n = n // 62
		return ''.join(reversed(shorturl))


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n != 0:
			rem = n % 62
			ans = s[rem] + ans
			n //= 62
		return ans


class Solution:

	def idToShortURL(self, n):
		encoding = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		l = []
		while n != 0:
			l += encoding[n % 62]
			n //= 62
		return ''.join(l[::-1])


class Solution:

	def idToShortURL(self, n):
		if n == 0:
			return ''
		rem_value = n % 62
		char_for_rem_value = self._get_base_62_char_for_value(rem_value)
		return self.idToShortURL(n // 62) + char_for_rem_value

	@staticmethod
	def _get_base_62_char_for_value(value):
		if value < 26:
			char = chr(ord('a') + value)
		elif value < 52:
			char = chr(ord('A') + (value - 26))
		else:
			char = chr(ord('0') + (value - 52))
		return char


class Solution:

	def idToShortURL(self, n):
		ans = ''
		map = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n:
			ans += map[n % 62]
			n //= 62
		return ans[len(ans) - 1::-1]


class Solution:

	def idToShortURL(self, n):
		BASE62 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		shortUrl = ''
		while n:
			(n, r) = divmod(n, 62)
			shortUrl = BASE62[r] + shortUrl
		return shortUrl


class Solution:

	def idToShortURL(self, n):
		digits = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		l = []
		while n >= 62:
			(n, r) = (n // 62, n % 62)
			l.append(digits[r])
		l.append(digits[n])
		return ''.join(l[::-1])


class Solution:

	def idToShortURL(self, n):
		base62_table = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		mod = len(base62_table)
		rev_url = []
		while n > 0:
			rem = n % mod
			rev_url.append(base62_table[rem])
			n = n // mod
		return ''.join(rev_url[::-1])


import string

class Solution:
	alphabet = string.ascii_lowercase + string.ascii_uppercase + string.digits
	base = 62

	def idToShortURL(self, num):
		digits = []
		while num > 0:
			r = num % self.base
			digit = self.alphabet[r]
			digits.append(digit)
			num = int(num // self.base)
		return ''.join(list(reversed(digits)))


class Solution:

	def idToShortURL(self, n):
		k = 97
		s = {}
		for i in range(26):
			s[i] = chr(k)
			k += 1
		k = 65
		for i in range(26, 52):
			s[i] = chr(k)
			k += 1
		k = 48
		for i in range(52, 62):
			s[i] = chr(k)
			k += 1
		t = ''
		while n != 0:
			t += s[n % 62]
			n = n // 62
		return t[::-1]


class Solution:

	def idToShortURL(self, n):
		map = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		o = ''
		n = int(n)
		while n:
			o += map[n % 62]
			n = n // 62
		return o[len(o)::-1]


table = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
D = 62

class Solution:

	def idToShortURL(self, n):
		result = []
		while n:
			result.append(table[n % D])
			n = n // D
		return ''.join(reversed(result))


class Solution:

	def idToShortURL(self, n):
		s = ''
		d = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n > 0:
			x = n % 62
			if x >= 0 and x <= 25:
				s += chr(x + ord('a'))
			elif x >= 26 and x <= 51:
				s += chr(x + ord('A') - 26)
			else:
				s += chr(x + ord('0') - 52)
			n //= 62
		return s[::-1]


class Solution:

	def idToShortURL(self, n):
		alnum = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n > 0:
			ans += alnum[n % 62]
			n = n // 62
		return ans[::-1]


class Solution:

	def idToShortURL(self, n):
		ans = ''
		arr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n:
			ans += arr[n % 62]
			n = n // 62
		string = ans[::-1]
		return string

def shortURLToId(shortURL):
	id = 0
	for i in shortURL:
		val_i = ord(i)
		if val_i >= ord('a') and val_i <= ord('z'):
			id = id * 62 + val_i - ord('a')
		elif val_i >= ord('A') and val_i <= ord('Z'):
			id = id * 62 + val_i - ord('A') + 26
		else:
			id = id * 62 + val_i - ord('0') + 52
	return id
if __name__ == '__main__':
	tc = int(input())
	while tc > 0:
		n = int(input())
		ob = Solution()
		url = ob.idToShortURL(n)
		print(url)
		print(shortURLToId(url))
		tc -= 1


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		p = 1
		while True:
			if 62 ** p > n:
				p -= 1
				break
			p += 1
		res = ''
		for i in range(p, -1, -1):
			cur = n // 62 ** i
			res += s[cur]
			n = n % 62 ** i
		return res

def shortURLToId(shortURL):
	id = 0
	for i in shortURL:
		val_i = ord(i)
		if val_i >= ord('a') and val_i <= ord('z'):
			id = id * 62 + val_i - ord('a')
		elif val_i >= ord('A') and val_i <= ord('Z'):
			id = id * 62 + val_i - ord('A') + 26
		else:
			id = id * 62 + val_i - ord('0') + 52
	return id
if __name__ == '__main__':
	tc = int(input())
	while tc > 0:
		n = int(input())
		ob = Solution()
		url = ob.idToShortURL(n)
		print(url)
		print(shortURLToId(url))
		tc -= 1


class Solution:

	def idToShortURL(self, n):
		base62 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		n62 = []
		(q, r, d) = (0, 0, 62)
		while n > 0:
			q = n // d
			r = n % d
			n62.append(base62[r])
			n = q
		n62.reverse()
		return ''.join(n62)

def shortURLToId(shortURL):
	id = 0
	for i in shortURL:
		val_i = ord(i)
		if val_i >= ord('a') and val_i <= ord('z'):
			id = id * 62 + val_i - ord('a')
		elif val_i >= ord('A') and val_i <= ord('Z'):
			id = id * 62 + val_i - ord('A') + 26
		else:
			id = id * 62 + val_i - ord('0') + 52
	return id
if __name__ == '__main__':
	tc = int(input())
	while tc > 0:
		n = int(input())
		ob = Solution()
		url = ob.idToShortURL(n)
		print(url)
		print(shortURLToId(url))
		tc -= 1


class Solution:

	def idToShortURL(self, n):
		charMap = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		result = ''
		while n:
			result = charMap[n % 62] + result
			n = n // 62
		return result


class Solution:

	def idToShortURL(self, n):
		baseStr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		out = ''
		while n > 0:
			out = baseStr[n % 62] + out
			n = n // 62
		return out


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		res = ''
		while n > 0:
			i = n
			n = n // 62
			ind = i - n * 62
			res = s[ind] + res
		return res


class Solution:

	def idToShortURL(self, n):
		res = ''
		mp = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n > 0:
			co = n % 62
			res = mp[co] + res
			n = n // 62
		return res


class Solution:

	def idToShortURL(self, n):
		str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		output = ''
		while n > 0:
			rem = n % 62
			output += str[rem]
			n = n // 62
		return output[::-1]


class Solution:

	def idToShortURL(self, n):
		map = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		shortURL = ''
		while n > 0:
			shortURL += map[n % 62]
			n //= 62
		return shortURL[::-1]


class Solution:

	def idToShortURL(self, n):
		st = ''
		dic = {}
		for i in range(97, 123):
			dic[i - 97] = chr(i)
		for i in range(65, 91):
			dic[i - 39] = chr(i)
		for i in range(48, 58):
			dic[i + 4] = chr(i)
		while n >= 62:
			q = n // 62
			r = n % 62
			st = dic[r] + st
			n = q
		st = dic[n] + st
		return st


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		x = n
		l = []
		while x > 0:
			l.append(x % 62)
			x = x // 62
		l = l[::-1]
		res = []
		for i in l:
			res.append(s[i])
		return ''.join(res)


class Solution:

	def idToShortURL(self, n):
		alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		result = ''
		while n > 0:
			result += alpha[n % 62]
			n //= 62
		return result[::-1]


class Solution:

	def idToShortURL(self, n):
		digits = dict()
		counter = 0
		for key in range(62):
			if key < 26:
				digits[key] = chr(ord('a') + key)
			elif key >= 26 and key < 52:
				digits[key] = chr(ord('A') + key - 26)
			else:
				digits[key] = counter
				counter += 1
		remainders = []
		while n:
			rem = n % 62
			remainders.append(rem)
			n //= 62
		result = ''
		for i in range(len(remainders) - 1, -1, -1):
			char = digits[remainders[i]]
			result += str(char)
		return result


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		shortURL = ''
		while n:
			shortURL = s[n % 62] + shortURL
			n //= 62
		return shortURL


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n:
			x = n % 62
			ans = ans + s[x]
			n = n // 62
		z = ''
		for i in range(len(ans)):
			z = z + ans[len(ans) - 1 - i]
		return z


class Solution:
	base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

	def idToShortURL(self, n):
		base_len = len(self.base)
		url = ''
		while n > 0:
			url += self.base[n % base_len]
			n = n // base_len
		return url[::-1]


class Solution:

	def idToShortURL(self, n):
		new_url = ''
		st = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while n > 0:
			new_url = st[n % 62] + new_url
			n //= 62
		return new_url


class Solution:

	def idToShortURL(self, n):
		code = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		l = 62
		url = ''
		while n > 0:
			url = url + code[n % l]
			n //= l
		url = url[::-1]
		return url


class Solution:

	def idToShortURL(self, n):
		shortCode = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		base = len(shortCode)
		shortURL = ''
		while n:
			(n, r) = divmod(n, base)
			shortURL = shortCode[r] + shortURL
		return shortURL


class Solution:

	def idToShortURL(self, n):
		temp = n
		url = ''
		string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		while temp > 0:
			rem = temp % 62
			url = url + string[rem]
			temp = temp // 62
		url = url[::-1]
		return url


class Solution:

	def idToShortURL(self, n):
		string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		N = 62
		ret = ''
		while n != 0:
			c = n % N
			ret = string[c] + ret
			n = n // N
		return ret


class Solution:

	def idToShortURL(self, n):
		s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		n = int(n)
		ns = ''
		while n > 0:
			ns += s[n % 62]
			n = n // 62
		return ns[::-1]


class Solution:

	def idToShortURL(self, n):
		d = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		res = ''
		while n != 0:
			res += str(d[n % 62])
			n = n // 62
		return res[::-1]


class Solution:

	def idToShortURL(self, n):
		base62 = []
		for i in range(26):
			base62.append(chr(ord('a') + i))
		for i in range(26):
			base62.append(chr(ord('A') + i))
		for i in range(10):
			base62.append(chr(ord('0') + i))
		res = ''
		while n != 0:
			res = base62[n % 62] + res
			n = n // 62
		return res


class Solution:

	def idToShortURL(self, n):
		data = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		url = ''
		while n > 0:
			ch = data[n % 62]
			url += ch
			n = n // 62
		return url[::-1]


class Solution:

	def idToShortURL(self, n):
		string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		url = ''
		while n > 0:
			r = n % 62
			url += string[r]
			n = n // 62
		return url[::-1]


class Solution:

	def idToShortURL(self, n):
		chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		r = ''
		while n:
			r = chars[n % 62] + r
			n = n // 62
		return r


class Solution:

	def idToShortURL(self, n):
		dic = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		s = ''
		while n:
			s += dic[n % 62]
			n //= 62
		return s[::-1]


class Solution:

	def idToShortURL(self, n):
		a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		s = []
		while n != 0:
			b = n % 62
			s.append(b)
			n = n // 62
		s = s[::-1]
		ans = ''
		for i in s:
			ans += a[i]
		return ans


class Solution:

	def idToShortURL(self, n):
		for i in range(n):
			checker = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
			ans = ''
			while n > 0:
				res = n % 62
				n = n // 62
				ans += checker[res]
			return ans[::-1]


class Solution:

	def idToShortURL(self, n):
		data = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		res = []
		while n:
			res.append(n % 62)
			n = n // 62
		res = res[::-1]
		st = ''
		for i in res:
			st += data[i]
		return st


import math

class Solution:

	def idToShortURL(self, n):
		values = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		base = 62
		solution = ''
		while n:
			solution += values[n - math.floor(n // base * base)]
			n //= base
		return solution[::-1]


class Solution:

	def idToShortURL(self, n):
		str1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		lst = []
		while n != 0:
			mod = n % 62
			n = n // 62
			lst.append(str1[mod])
		lst.reverse()
		str2 = ''
		return str2.join(lst)


class Solution:

	def idToShortURL(self, n):
		base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		ans = ''
		while n > 0:
			ans += base[int(n % 62)]
			n //= 62
		return ans[::-1]


import math
BASE_DIGITS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
BASE = len(BASE_DIGITS)

class Solution:

	def idToShortURL(self, n):
		if n < BASE:
			return BASE_DIGITS[n]
		newBaseNumber = ''
		closestPower = int(math.log(n) // math.log(BASE))
		for p in reversed(range(1, closestPower + 1)):
			divisor = BASE ** p
			newDigit = n // divisor
			newBaseNumber += BASE_DIGITS[newDigit]
			n = n % divisor
		newBaseNumber += BASE_DIGITS[n]
		return newBaseNumber


class Solution:

	def idToShortURL(self, n):
		char = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
		URL = ''
		while n:
			URL += char[n % 62]
			n //= 62
		return ''.join(reversed(URL))


class Solution:

	def __init__(self):
		self.m = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

	def idToShortURL(self, n):
		res = ''
		while n:
			res += self.m[n % 62]
			n = n // 62
		return res[::-1]