Tokitsukaze is one of the characters in the game "Kantai Collection". In this game, every character has a common attribute — health points, shortened to HP.

In general, different values of HP are grouped into $4$ categories:  Category $A$ if HP is in the form of $(4 n + 1)$, that is, when divided by $4$, the remainder is $1$;  Category $B$ if HP is in the form of $(4 n + 3)$, that is, when divided by $4$, the remainder is $3$;  Category $C$ if HP is in the form of $(4 n + 2)$, that is, when divided by $4$, the remainder is $2$;  Category $D$ if HP is in the form of $4 n$, that is, when divided by $4$, the remainder is $0$. 

The above-mentioned $n$ can be any integer.

These $4$ categories ordered from highest to lowest as $A > B > C > D$, which means category $A$ is the highest and category $D$ is the lowest.

While playing the game, players can increase the HP of the character. Now, Tokitsukaze wants you to increase her HP by at most $2$ (that is, either by $0$, $1$ or $2$). How much should she increase her HP so that it has the highest possible category?


-----Input-----

The only line contains a single integer $x$ ($30 \leq x \leq 100$) — the value Tokitsukaze's HP currently.


-----Output-----

Print an integer $a$ ($0 \leq a \leq 2$) and an uppercase letter $b$ ($b \in \lbrace A, B, C, D \rbrace$), representing that the best way is to increase her HP by $a$, and then the category becomes $b$.

Note that the output characters are case-sensitive.


-----Examples-----
Input
33

Output
0 A

Input
98

Output
1 B



-----Note-----

For the first example, the category of Tokitsukaze's HP is already $A$, so you don't need to enhance her ability.

For the second example:  If you don't increase her HP, its value is still $98$, which equals to $(4 \times 24 + 2)$, and its category is $C$.  If you increase her HP by $1$, its value becomes $99$, which equals to $(4 \times 24 + 3)$, and its category becomes $B$.  If you increase her HP by $2$, its value becomes $100$, which equals to $(4 \times 25)$, and its category becomes $D$. 

Therefore, the best way is to increase her HP by $1$ so that the category of her HP becomes $B$.

Source: codeforces | Difficulty: EASY
Tags: Complete search


Solutions:
HP = int(input())
if HP % 4 == 1:
	print(0, 'A')
elif HP % 4 == 3:
	print(2, 'A')
elif HP % 4 == 2:
	print(1, 'B')
elif HP % 4 == 0:
	print(1, 'A')


from random import randint

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
q = int(input())
if q % 4 == 0:
	print(1, 'A')
elif q % 4 == 1:
	print(0, 'A')
elif q % 4 == 2:
	print(1, 'B')
else:
	print(2, 'A')


n = int(input())
if n % 4 == 0:
	print('{} {}'.format(1, 'A'))
elif n % 4 == 1:
	print('{} {}'.format(0, 'A'))
elif n % 4 == 2:
	print('{} {}'.format(1, 'B'))
else:
	print('{} {}'.format(2, 'A'))


hp = int(input())
categories = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
options = [0, 1, 2]
best_category = 'D'
best_option = None
for option in options:
	remainder = (hp + option) % 4
	category = categories[remainder]
	if category < best_category:
		best_category = category
		best_option = option
print(best_option, best_category)


x = int(input())
if x % 4 == 1:
	print(0, ' A')
elif x % 4 == 3:
	print(2, ' A')
elif x % 4 == 2:
	print(1, ' B')
else:
	print(1, ' A')


thing = int(input())
if thing % 4 != 2:
	print(str((5 - thing % 4) % 4) + ' A')
else:
	print('1 B')


n = int(input())
ans = 'Z'
m = 0
l = ['D', 'A', 'C', 'B']
for i in range(0, 3):
	x = l[(n + i) % 4]
	if x < ans:
		ans = x
		m = i
print(m, ans)


n = int(input())
if abs(n - 1) % 4 == 0:
	print('0 A')
elif abs(n - 3) % 4 == 0:
	print('2 A')
elif abs(n - 2) % 4 == 0:
	print('1 B')
elif abs(n) % 4 == 0:
	print('1 A')


print(['1 A', '0 A', '1 B', '2 A'][int(input()) % 4])


hp = int(input())
if hp % 4 == 1:
	print(0, 'A')
	exit()
if hp % 4 == 3:
	print(2, 'A')
	exit()
if hp % 4 == 2:
	print(1, 'B')
	exit()
if hp % 4 == 0:
	print(1, 'A')
	exit()


a = int(input())
x = a % 4
if x == 0:
	print(1, 'A')
if x == 1:
	print(0, 'A')
if x == 2:
	print(1, 'B')
if x == 3:
	print(2, 'A')


num = int(input())
r = num % 4
if r == 0:
	print(1, 'A')
elif r == 1:
	print(0, 'A')
elif r == 2:
	print(1, 'B')
elif r == 3:
	print(2, 'A')


a = ['A', 'A', 'B', 'A']
b = abs(int(input()) % 4)
print(str(abs(b - 1)) + ' ' + a[b])


hp = int(input())
if hp % 4 == 0:
	cat = 'A'
	ans = 1
if hp % 4 == 1:
	cat = 'A'
	ans = 0
if hp % 4 == 2:
	cat = 'B'
	ans = 1
if hp % 4 == 3:
	cat = 'A'
	ans = 2
print(ans, cat)


hp_curr = int(input())
result_1 = 0
result = ' '
for i in range(3):
	tmp = (hp_curr + i) % 4
	char = ''
	if tmp == 3:
		char = 'B'
	if tmp == 2:
		char = 'C'
	if tmp == 1:
		char = 'A'
	if tmp == 0:
		char = 'D'
	if char < result or result == ' ':
		result_1 = i
		result = char
print(result_1, result)


hp = int(input())
cat = ['D', 'A', 'C', 'B']
cur = cat[hp % 4]
cur_1 = cat[(hp + 1) % 4]
cur_2 = cat[(hp + 2) % 4]
ans = min(cur, cur_1, cur_2)
if ans == cur:
	print(0, cur)
if ans == cur_1:
	print(1, cur_1)
if ans == cur_2:
	print(2, cur_2)


n = int(input())
rem = n % 4
if rem == 0:
	print(1, 'A')
if rem == 1:
	print(0, 'A')
if rem == 2:
	print(1, 'B')
if rem == 3:
	print(2, 'A')


n = int(input())
re = n % 4
w = 'A'
if re == 1:
	q = 0
elif re == 3:
	q = 2
elif re == 2:
	q = 1
	w = 'B'
elif re == 0:
	q = 1
print('{} {}'.format(q, w))


a = int(input())
priority = [1, 3, 2, 0]
if a % 4 == 0:
	print(1, 'A')
elif a % 4 == 1:
	print(0, 'A')
elif a % 4 == 2:
	print(1, 'B')
elif a % 4 == 3:
	print(2, 'A')


current_hp = int(input())
category = 'D'
for i in range(3):
	if (current_hp + i) % 4 == 1 and category > 'A':
		category = 'A'
		j = i
		break
	elif (current_hp + i) % 4 == 3 and category > 'B':
		category = 'B'
		j = i
	elif (current_hp + i) % 4 == 2 and category > 'D':
		category = 'D'
		j = i
print(j, category)


integer = input()
remainder = int(integer) % 4
if remainder == 1:
	print(str(0) + ' A')
elif remainder == 3:
	print(str(2) + ' A')
elif remainder == 2:
	print(str(1) + ' B')
elif remainder == 0:
	print(str(1) + ' A')


n = int(input())
v = n % 4
if v == 1:
	print('0 A')
elif v == 2:
	print('1 B')
elif v == 3:
	print('2 A')
else:
	print('1 A')


n = int(input())
rest = n % 4
d = {0: (1, 'A'), 1: (0, 'A'), 2: (1, 'B'), 3: (2, 'A')}
print(d[rest][0], d[rest][1])


cats = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
n = int(input())
cur_best = cats[n % 4]
icr = 0
for i in range(1, 3):
	if cats[(n + i) % 4] < cur_best:
		cur_best = cats[(n + i) % 4]
		icr = i
print(icr, cur_best)


a = int(input()) % 4
if a == 0:
	print('1 A')
elif a == 1:
	print('0 A')
elif a == 2:
	print('1 B')
else:
	print('2 A')


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
initial = int(f_input())
switch = {1: '0 A', 3: '2 A', 2: '1 B', 0: '1 A'}
f_print(switch[initial % 4])


n = int(input())
M = 'E'
m = 4
for i in range(3):
	cur = n + i
	S = ''
	if cur % 4 == 1:
		S = 'A'
	elif cur % 4 == 3:
		S = 'B'
	elif cur % 4 == 2:
		S = 'C'
	else:
		S = 'D'
	if M > S:
		m = i
		M = S
print(m, M)


q = int(input())
w = q % 4
if w == 1:
	print('0 A')
if w == 2:
	print('1 B')
if w == 3:
	print('2 A')
if w == 0:
	print('1 A')


t = int(input())
res = t % 4
if res == 0:
	print('1', 'A')
elif res == 1:
	print('0', 'A')
elif res == 2:
	print('1', 'B')
elif res == 3:
	print('2', 'A')


ranks = 'ABCD'

def rank(n):
	remainder = n % 4
	if remainder == 1:
		return 'A'
	elif remainder == 2:
		return 'C'
	elif remainder == 3:
		return 'B'
	return 'D'
hp = int(input(''))
c_rank = rank(hp)
e = 0
for enhance in range(0, 3, 1):
	newrank = rank(hp + enhance)
	if ranks.index(newrank) < ranks.index(c_rank):
		e = enhance
		c_rank = newrank
print('%d %c' % (e, c_rank))


n = int(input())
a = n % 4
b = (n + 1) % 4
c = (n + 2) % 4
if a == 1:
	print(0, 'A')
elif b == 1:
	print(1, 'A')
elif c == 1:
	print(2, 'A')
elif a == 3:
	print(0, 'B')
elif b == 3:
	print(1, 'B')
elif c == 3:
	print(2, 'B')
elif a == 2:
	print(0, 'C')
elif b == 2:
	print(1, 'C')
elif c == 2:
	print(2, 'C')
else:
	print(0, 'D')


import sys
readline = sys.stdin.readline
N = int(readline())
if N % 4 == 2:
	print(1, 'B')
else:
	print([1, 0, None, 2][N % 4], 'A')


n = int(input())
d = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
a = [(d[n % 4], 0), (d[(n + 1) % 4], 1), (d[(n + 2) % 4], 2)]
a.sort()
print(a[0][1], a[0][0])


from sys import stdin, stdout, exit
d = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
x = int(input())
r = x % 4
if r == 1:
	print(0, 'A')
elif r == 2:
	print(1, 'B')
elif r == 3:
	print(2, 'A')
elif r == 0:
	print(1, 'A')


OHP = int(input())

def category(HP):
	if HP % 4 == 1:
		return 'A'
	elif HP % 4 == 3:
		return 'B'
	elif HP % 4 == 2:
		return 'C'
	elif HP % 4 == 0:
		return 'D'

def GCP():
	if category(OHP) == 'D':
		return '1 A'
	elif category(OHP) == 'A':
		return '0 A'
	elif category(OHP) == 'C':
		return '1 B'
	elif category(OHP) == 'B':
		return '2 A'
print(GCP())


x = int(input())
a = ''
b = ''
c = ''
if x % 4 == 1:
	print('0 A')
else:
	x += 1
	if x % 4 == 1:
		print('1 A')
	else:
		x += 1
		if x % 4 == 1:
			print('2 A')
		else:
			x -= 2
			if x % 4 == 3:
				print('0 B')
			else:
				x += 1
				if x % 4 == 3:
					print('1 B')
				else:
					x += 1
					if x % 4 == 3:
						print('2 B')
					else:
						x -= 2
						if x % 4 == 2:
							print('0 C')
						else:
							x += 1
							if x % 4 == 2:
								print('1 C')
							else:
								x += 1
								if x % 4 == 2:
									print('2 C')


def ppp(n):
	if n == 1:
		return 4
	if n == 3:
		return 3
	if n == 2:
		return 2
	if n == 0:
		return 1
n = int(input())
l = [1, 3, 2, 0]
l1 = []
l1.append(n % 4)
l1.append((n + 1) % 4)
l1.append((n + 2) % 4)
l3 = [i % 4 for i in l1]
l4 = [ppp(i) for i in l3]
ma = max(l4)
l2 = ['A', 'B', 'C', 'D']
print(l4.index(ma), l2[4 - ma])


value = int(input(''))
if 30 <= value <= 100:
	if value % 4 == 0:
		print(1, 'A')
	else:
		rem = value % 4
		if rem == 1:
			print(0, 'A')
		elif rem == 2:
			print(1, 'B')
		elif rem == 3:
			print(2, 'A')


l = ['A', 'B', 'C', 'D']
lvl = 5
n = int(input())
indx = 0
ans2 = 0
for i in range(n, n + 3):
	c = i % 4
	if c == 0:
		if lvl > 4:
			lvl = min(lvl, 4)
			indx = 3
			ans2 = i - n
	if c == 2:
		if lvl > 3:
			lvl = min(lvl, 3)
			indx = 2
			ans2 = i - n
	if c == 3:
		if lvl > 2:
			lvl = min(lvl, 2)
			indx = 1
			ans2 = i - n
	if c == 1:
		if lvl > 1:
			lvl = min(lvl, 1)
			indx = 0
			ans2 = i - n
print(ans2, l[indx])


n = int(input())
d = n % 4
if d == 1:
	print(0, 'A')
else:
	if d == 2:
		print(1, 'B')
	if d == 3:
		print(2, 'A')
	if d == 0:
		print(1, 'A')


num = int(input())
inc = 0
let = 0
if num % 4 == 0:
	inc = 1
	let = 'A'
elif num % 4 == 2:
	inc = 1
	let = 'B'
elif num % 4 == 3:
	inc = 2
	let = 'A'
else:
	inc = 0
	let = 'A'
print(inc, let)


tmp = input()
tmp = int(tmp)
score = 0
max_num = -1
plus = 0
rank = ''
char = ''
for i in range(3):
	b = tmp + i
	if b % 4 == 0:
		score = 0
		char = 'D'
	elif b % 4 == 1:
		score = 3
		char = 'A'
	elif b % 4 == 2:
		score = 1
		char = 'C'
	else:
		score = 2
		char = 'B'
	if score > max_num:
		max_num = score
		plus = i
		rank = char
print(plus, rank)


x = int(input())
if x % 4 != 2:
	y = (x + 2) // 4 * 4
	y += 1
	need_to_add = y - x
	print(need_to_add, 'A')
else:
	print(1, 'B')


def get_alpha(n):
	rest = n % 4
	if rest == 1:
		return 'A'
	elif rest == 3:
		return 'B'
	elif rest == 2:
		return 'C'
	else:
		return 'D'
n = int(input())
k = 0
t = 0
m = get_alpha(n)
for k in range(3):
	if get_alpha(n + k) < m:
		m = get_alpha(n + k)
		t = k
print(t, m)


lvl = int(input())
key1 = lvl % 4
if key1 == 1:
	print('0 A')
elif key1 == 2:
	print('1 B')
elif key1 == 3:
	print('2 A')
elif key1 == 0:
	print('1 A')


def main():
	x = int(input())
	r = x % 4
	if r == 0:
		print(1, 'A')
	elif r == 1:
		print(0, 'A')
	elif r == 3:
		print(2, 'A')
	elif r == 2:
		print(1, 'B')
main()


n = int(input())
r = n % 4
if r == 1:
	l = 'A'
	r = 0
elif r == 3:
	l = 'A'
	r = 2
elif r == 2:
	l = 'B'
	r = 1
else:
	l = 'A'
	r = 1
print(r, l)


def rang(ctg):
	if ctg == 'A':
		return 3
	elif ctg == 'B':
		return 2
	elif ctg == 'C':
		return 1
	elif ctg == 'D':
		return 0

def categ(n):
	rest = n % 4
	if rest == 1:
		return 'A'
	elif rest == 3:
		return 'B'
	elif rest == 2:
		return 'C'
	elif rest == 0:
		return 'D'
hp = int(input())
rang0 = rang(categ(hp))
rang1 = rang(categ(hp + 1))
rang2 = rang(categ(hp + 2))
mx = max(rang0, rang1, rang2)
ans = None
if rang0 == mx:
	ans = 0
elif rang1 == mx:
	ans = 1
elif rang2 == mx:
	ans = 2
print(ans, categ(hp + ans))


category = {1: 0, 2: 2, 3: 1, 0: 4}
inp = int(input())
res = category[inp - inp // 4 * 4]
a = 0
for inc in range(1, 3):
	if category[(inp + inc - inp // 4 * 4) % 4] < res:
		res = category[(inp + inc - inp // 4 * 4) % 4]
		a = inc
print(a, chr(res + 65))


from math import *

def main():
	x: int
	x = int(input())
	arr = []
	arr.append(x % 4)
	arr.append((arr[0] + 1) % 4)
	arr.append((arr[0] + 2) % 4)
	mars = [[arr[0], arr[1], arr[2]], [0, 1, 2]]
	arr2 = []
	i: int = 0
	pos = 0
	while i < 3:
		if arr[i] == 1:
			arr2.append(arr[i])
			arr2.append(i)
			break
		i += 1
	i = 0
	while i < 3:
		if arr[i] == 3:
			arr2.append(arr[i])
			arr2.append(i)
			break
		i += 1
	i = 0
	while i < 3:
		if arr[i] == 2:
			arr2.append(arr[i])
			arr2.append(i)
			break
		i += 1
	i = 0
	while i < 3:
		if arr[i] == 0:
			arr2.append(arr[i])
			arr2.append(i)
			break
		i += 1
	i = 0
	e = x + arr2[1]
	if e % 4 == 1:
		print(str(arr2[1]) + ' A')
	if e % 4 == 3:
		print(str(arr2[1]) + ' B')
	if e % 4 == 2:
		print(str(arr2[1]) + ' C')
	if e % 4 == 0:
		print(str(arr2[1]) + ' D')
main()


hp = int(input())
ls = [0, 'D', 2, 'C', 3, 'B', 1, 'A']
curr = hp % 4
if curr == 1:
	print('0 A')
	exit()
if curr == 0:
	print('1 A')
	exit()
if curr == 2:
	print('1 B')
	exit()
if curr == 3:
	print('2 A')
	exit()


from sys import stdin
input = stdin.readline
x = int(input())
c = x % 4
if c == 0:
	print('1 A')
elif c == 1:
	print('0 A')
elif c == 2:
	print('1 B')
else:
	print('2 A')


x = int(input())
d = {1: 4, 2: 2, 3: 3, 0: 1}
c = {4: 'A', 2: 'C', 3: 'B', 1: 'D'}
a = [d[x % 4], d[(x + 1) % 4], d[(x + 2) % 4]]
print(a.index(max(a)), c[max(a)])


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	hp = Scanner.int()
	if hp % 4 == 0:
		print('1 A')
	elif hp % 4 == 1:
		print('0 A')
	elif hp % 4 == 2:
		print('1 B')
	else:
		print('2 A')
main()


def main():
	n = int(input())
	cat = ['D', 'A', 'C', 'B']
	init_cat = cat[n % 4]
	final_cat = init_cat
	count = 0
	if cat[n % 4] <= final_cat:
		final_cat = cat[n % 4]
		count = 0
	if cat[(n + 1) % 4] <= final_cat:
		final_cat = cat[(n + 1) % 4]
		count = 1
	if cat[(n + 2) % 4] <= final_cat:
		final_cat = cat[(n + 2) % 4]
		count = 2
	print(count, final_cat)
main()


n = int(input())
kostyl = ['D', 'A', 'C', 'B']
lst = []
lst.append(ord(kostyl[n % 4]))
lst.append(ord(kostyl[(n + 1) % 4]))
lst.append(ord(kostyl[(n + 2) % 4]))
print(lst.index(min(lst)), chr(min(lst)))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = int(input())
m = n % 4
if m == 0:
	print('1 A')
elif m == 1:
	print('0 A')
elif m == 2:
	print('1 B')
elif m == 3:
	print('2 A')


x = int(input())
prior = {'A': 3, 'B': 2, 'C': 1, 'D': 0}
f = ['D', 'A', 'C', 'B']
l = f[x % 4]
i = prior[f[x % 4]]
k = 0
for j in range(1, 3):
	a = f[(x + j) % 4]
	if prior[a] > i:
		l = a
		i = prior[a]
		k = j
print(k, l)


n = int(input())
l = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
m = []
p = []
a = n % 4
b = (n + 1) % 4
c = (n + 2) % 4
x = str(l.get(a))
y = str(l.get(b))
z = str(l.get(c))
if x < y and x < z:
	print('0', end=' ')
	print(x)
elif y < x and y < z:
	print('1', end=' ')
	print(y)
elif z < x and z < y:
	print('2', end=' ')
	print(z)


x = int(input())
di = [0, 3, 1, 2]
di2 = ['D', 'A', 'C', 'B']
re = di[x % 4]
imax = 0
for i in range(1, 3):
	if re < di[(x + i) % 4]:
		imax = i
		re = di[(x + i) % 4]
print(imax, di2[di.index(re)])


import sys
data = sys.stdin.readlines()
true_in = int(data[0].rstrip())
if true_in % 4 == 0:
	print('1 A')
if true_in % 4 == 1:
	print('0 A')
if true_in % 4 == 2:
	print('1 B')
if true_in % 4 == 3:
	print('2 A')


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
ins = int(input())
mode = ins % 4
if mode == 1:
	print(0, 'A')
elif mode == 2:
	print(1, 'B')
elif mode == 3:
	print(2, 'A')
else:
	print(1, 'A')


def answer():
	a = int(input())
	if a % 4 == 1:
		print(str(0), 'A')
	elif a % 4 == 2:
		print(str(1), 'B')
	elif a % 4 == 3:
		print(str(2), 'A')
	else:
		print(str(1), 'A')
answer()


import sys
import collections
input = sys.stdin.readline

def printnl(val):
	sys.stdout.write(str(val) + '\n')
x = int(input())
if x % 4 == 0:
	print('1 A')
elif x % 4 == 1:
	print('0 A')
elif x % 4 == 2:
	print('1 B')
else:
	print('2 A')


i = int(input())
rem = i % 4
if rem == 0:
	print('1 A')
elif rem == 1:
	print('0 A')
elif rem == 2:
	print('1 B')
else:
	print('2 A')


n = int(input())
hp = ['D', 'A', 'C', 'B']
x = n % 4
if x == 1:
	print(0, end=' ')
	print(hp[1])
elif x == 2:
	print(1, end=' ')
	print(hp[3])
elif x == 3:
	print(2, end=' ')
	print(hp[1])
elif x == 0:
	print(1, end=' ')
	print(hp[1])


hp = int(input())
rank_dict = {}
rank_dict[1] = 'A'
rank_dict[3] = 'B'
rank_dict[2] = 'C'
rank_dict[0] = 'D'
x = rank_dict[hp % 4]
y = rank_dict[(hp + 1) % 4]
z = rank_dict[(hp + 2) % 4]
best = 0
icon = x
if y < x:
	best = 1
	icon = y
if z < icon:
	best = 2
	icon = z
print('%d %s' % (best, icon))


l = ['D', 'A', 'C', 'B']
x = int(input()) % 4
b = 0
s = l[x]
for i in range(1, 3):
	x = (x + 1) % 4
	if l[x] < s:
		s = l[x]
		b = i
print(b, s)


def main():
	n = int(input())
	d = {1: 0, 3: 1, 2: 2, 0: 3}
	dd = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
	res = [(d[n % 4], 0, n % 4), (d[(n + 1) % 4], 1, (n + 1) % 4), (d[(n + 2) % 4], 2, (n + 2) % 4)]
	res.sort()
	print(res[0][1], dd[res[0][2]])
main()


n = int(input())
if n % 4 == 1:
	k = 0
	s = 'A'
	print(k, s)
if n % 4 == 0:
	k = 1
	s = 'A'
	print(k, s)
if n % 4 == 2:
	k = 1
	s = 'B'
	print(k, s)
if n % 4 == 3:
	k = 2
	s = 'A'
	print(k, s)


n = int(input())
if n % 4 == 2:
	print(1, 'B')
else:
	print((5 - n % 4) % 4, 'A')


n = int(input())
rank = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
grade = [rank[n % 4], rank[(n + 1) % 4], rank[(n + 2) % 4]]
if 'A' in grade:
	print(grade.index('A'), 'A')
elif 'B' in grade:
	print(grade.index('B'), 'B')
elif 'C' in grade:
	print(grade.index('C'), 'C')
elif 'D' in grade:
	print(grade.index('D'), 'D')


n = eval(input())
m = n % 4
if m == 0:
	print(1, 'A')
elif m == 2:
	print(1, 'B')
elif m == 3:
	print(2, 'A')
elif m == 1:
	print(0, 'A')


n = int(input())
res = n % 4
ad = 0
c = '-'
if res == 0:
	ad = 1
	c = 'A'
elif res == 1:
	ad = 0
	c = 'A'
elif res == 2:
	ad = 1
	c = 'B'
elif res == 3:
	ad = 2
	c = 'A'
print(ad, c)


def f(x):
	return 'DACB'[x % 4]
n = int(input())
x = min(range(n, n + 3), key=f)
print(x - n, f(x))


x = int(input())
a = zip([1, 3, 2, 0], 'ABCD')
for (b, c) in a:
	for y in range(x, x + 3):
		if b == y % 4:
			print(y - x, c)
			exit()


n = int(input())
mapping = ['1 A', '0 A', '1 B', '2 A']
print(mapping[n % 4])


t = int(input())
cat = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
add = 0
char = {0: 'D', 1: 'A', 3: 'B', 2: 'C'}
ans = char[t % 4]
for i in range(3):
	if cat[char[(t + i) % 4]] < cat[ans]:
		ans = char[(t + i) % 4]
		add = i
print(add, ans)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
t = n % 4
if t == 0:
	print('1 A')
elif t == 1:
	print('0 A')
elif t == 2:
	print('1 B')
elif t == 3:
	print('2 A')


t = int(input())
rem = []
for i in range(0, 3):
	rem.append((t + i) % 4)
if 1 in rem:
	print(rem.index(1), 'A')
elif 3 in rem:
	print(rem.index(3), 'B')
elif 2 in rem:
	print(rem.index(2), 'C')
elif 0 in rem:
	print(rem.index(0), 'D')


def main():
	n = int(input())
	rem = n % 4
	if rem == 1:
		print('0 A')
	elif rem == 3:
		print('2 A')
	elif rem == 2:
		print('1 B')
	elif rem == 0:
		print('1 A')
main()


x = int(input())
temp = x & 3
if temp == 0:
	print('1 A')
elif temp == 1:
	print('0 A')
elif temp == 2:
	print('1 B')
elif temp == 3:
	print('2 A')


n = int(input())
n1 = n + 1
n2 = n + 2
if n % 4 == 1:
	print(0, 'A')
elif n1 % 4 == 1:
	print(1, 'A')
elif n2 % 4 == 1:
	print(2, 'A')
elif n % 4 == 3:
	print(0, 'B')
elif n1 % 4 == 3:
	print(1, 'B')
elif n2 % 4 == 3:
	print(2, 'B')
elif n % 4 == 2:
	print(0, 'C')
elif n1 % 4 == 2:
	print(1, 'C')
elif n2 % 4 == 2:
	print(2, 'C')
elif n % 4 == 0:
	print(0, 'D')
elif n1 % 4 == 0:
	print(1, 'D')
elif n2 % 4 == 0:
	print(2, 'D')


x = int(input())
r2c = ['D', 'A', 'C', 'B']
d_min = -1
c_min = ''
for d in range(3):
	c = r2c[(x + d) % 4]
	if d_min < 0 or c < c_min:
		d_min = d
		c_min = c
print(d_min, c_min)


n = int(input())
b = n % 4
if b == 0:
	print('1', end=' ')
	print('A')
if b == 1:
	print('0', end=' ')
	print('A')
if b == 2:
	print('1', end=' ')
	print('B')
if b == 3:
	print('2', end=' ')
	print('A')


T = int(input())
if T % 4 == 1:
	print(0, 'A')
if T % 4 == 0:
	print(1, 'A')
if T % 4 == 2:
	print(1, 'B')
if T % 4 == 3:
	print(2, 'A')


GI = lambda : int(input())
GIS = lambda : map(int, input().split())
LGIS = lambda : list(GIS())
CATS = 'DABC'

def main():
	x = GI()
	r = x % 4
	res = ['1 A', '0 A', '1 B', '2 A'][r]
	print(res)
main()


a = int(input())
print('1012'[a % 4], 'AABA'[a % 4])


x = int(input())
if x % 4 == 0:
	ret1 = 1
	ret2 = 'A'
elif x % 4 == 1:
	ret1 = 0
	ret2 = 'A'
elif x % 4 == 2:
	ret1 = 1
	ret2 = 'B'
elif x % 4 == 3:
	ret1 = 2
	ret2 = 'A'
print(str(ret1) + ' ' + ret2)


HP = int(input())
print(*(((5 - HP % 4) % 4, 'A'), (1, 'B'))[HP % 4 == 2])


b = int(input())
d = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
ans = d[b % 4]
add = 0
k = ans
for i in range(1, 3):
	ans = min(ans, d[(b + i) % 4])
	if k != ans:
		add = i
		k = ans
print(add, ans)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	rem = t % 4
	if rem == 1:
		print(0, 'A')
	elif rem == 2:
		print(1, 'B')
	elif rem == 0:
		print(1, 'A')
	else:
		print(2, 'A')
main()


import sys
hp = int(sys.stdin.readline())

def get_categ(nb):
	if nb % 4 == 0:
		return 3
	elif nb % 4 == 2:
		return 2
	elif nb % 4 == 3:
		return 1
	elif nb % 4 == 1:
		return 0
arr = [1, 2, 3]
for i in range(0, 3):
	arr[i] = get_categ(hp + i)
categ = 'ABCD'
letter_num = min(arr)
letter = categ[letter_num]
digit = arr.index(letter_num)
print(digit, letter)


from sys import stdin
N = int(stdin.read())
if N % 4 == 0:
	print(str(1) + ' A')
elif N % 4 == 1:
	print(str(0) + ' A')
elif N % 4 == 2:
	print(str(1) + ' B')
elif N % 4 == 3:
	print(str(2) + ' A')


t = int(input())
r = t % 4
if r == 1:
	print('0 A')
elif r == 2:
	print('1 B')
elif r == 3:
	print('2 A')
else:
	print('1 A')


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
if n % 4 == 0:
	print('1 A')
elif n % 4 == 1:
	print('0 A')
elif n % 4 == 2:
	print('1 B')
else:
	print('2 A')


def main():
	Current_HP = int(input())
	remainder = Current_HP % 4
	Current_rank = ''
	if remainder == 1:
		Current_rank = 'A'
		added_number = 0
		print(str(added_number) + ' ' + str(Current_rank))
	elif remainder == 2:
		Current_rank = 'B'
		added_number = 1
		print(str(added_number) + ' ' + str(Current_rank))
	elif remainder == 3:
		Current_rank = 'A'
		added_number = 2
		print(str(added_number) + ' ' + str(Current_rank))
	elif remainder == 0:
		Current_rank = 'A'
		added_number = 1
		print(str(added_number) + ' ' + str(Current_rank))
main()


import sys
import math
from collections import defaultdict
d = {'A': 1, 'B': 3, 'C': 2, 'D': 0}
n = int(input())
t = n % 4
if t == 0:
	print('1', 'A')
elif t == 1:
	print('0', 'A')
elif t == 2:
	print('1', 'B')
else:
	print('2', 'A')


n = int(input())
w = []
e = []
k = 0
r = []
w.append('A')
w.append('B')
w.append('C')
w.append('D')
q = []
q.append('1')
q.append('3')
q.append('2')
q.append('0')
a = n - n // 4 * 4
for i in range(3):
	if str(a) == q[i]:
		e.append(int(i))
n += 1
a = n - n // 4 * 4
for i in range(3):
	if str(a) == q[i]:
		e.append(int(i))
n += 1
a = n - n // 4 * 4
for i in range(3):
	if str(a) == q[i]:
		e.append(int(i))
u = int(q[min(e)])
n -= 2
for i in range(n, n + 3):
	if i - i // 4 * 4 == u:
		k = i
print(k - n, w[min(e)])


x = int(input())
rem = [-1, -1, -1, -1]
for i in range(0, 3):
	xx = x + i
	mod = xx % 4
	if rem[mod] == -1:
		rem[mod] = i
if rem[1] != -1:
	print(rem[1], 'A')
elif rem[3] != -1:
	print(rem[3], 'B')
elif rem[2] != -1:
	print(rem[2], 'C')
else:
	print(rem[0], 'D')


n = int(input())
if n % 4 == 1:
	cat = 'A'
elif n % 4 == 3:
	cat = 'B'
elif n % 4 == 2:
	cat = 'C'
elif n % 4 == 0:
	cat = 'D'
if cat == 'A':
	print('0' + ' ' + 'A')
elif cat == 'B':
	print('2' + ' ' + 'A')
elif cat == 'D':
	print('1' + ' ' + 'A')
elif cat == 'C':
	print('1' + ' ' + 'B')


x = int(input())

def getCategory(num):
	mod = num % 4
	if mod == 1:
		return 'A'
	elif mod == 3:
		return 'B'
	elif mod == 2:
		return 'C'
	return 'D'
currentCategory = getCategory(x)
plus = 0
if currentCategory == 'A':
	print(0, 'A')
else:
	newCategory = getCategory(x + 1)
	if newCategory < currentCategory:
		plus = 1
		currentCategory = newCategory
	newCategory = getCategory(x + 2)
	if newCategory < currentCategory:
		plus = 2
		currentCategory = newCategory
	print(plus, currentCategory)


n = int(int(input()))
cata = 1
catb = 3
catc = 2
catd = 0
list_poss_n = [(n + i) % 4 for i in range(0, 3)]
if list(filter(lambda x: x == cata, list_poss_n)):
	print(abs(cata - n % 4), 'A')
else:
	print(abs(catb - n % 4), 'B')


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def int1():
	return int(input())
import math
from itertools import combinations

def main():
	x = int1()
	if x % 4 == 1:
		print(0, 'A')
	else:
		if x % 4 == 0:
			print(1, 'A')
		if x % 4 == 2:
			print(1, 'B')
		if x % 4 == 3:
			print(2, 'A')
main()


n = int(input())
x = n % 4
s = [0, 3, 1, 2]
f = ['D', 'A', 'C', 'B']
d = [(s[(x + 0) % 4], 0), (s[(x + 1) % 4], 1), (s[(x + 2) % 4], 2)]
d.sort()
print(d[-1][1], f[(x + d[-1][1]) % 4])


x = int(input())
rem = []
rem.append(x % 4)
rem.append((x + 1) % 4)
rem.append((x + 2) % 4)
d = {'A': 1, 'B': 3, 'C': 2, 'D': 0}
e = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
f = {e[rem[0]]: 0, e[rem[1]]: 1, e[rem[2]]: 2}
j = list(f.keys())
j.sort()
print(f[j[0]], j[0])


n = int(input())
d = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
if n % 4 == 1:
	print(0, 'A')
else:
	a = (n + 1) % 4
	b = (n + 2) % 4
	for i in (1, 3, 2, 0):
		if a == i:
			print(1, d[i])
			break
		elif b == i:
			print(2, d[i])
			break


def hp(x):
	z = x % 4
	if z == 1:
		print(0, end=' ')
		print('A')
	if z == 2:
		print(1, end=' ')
		print('B')
	if z == 3:
		print(2, end=' ')
		print('A')
	if z == 0:
		print(1, end=' ')
		print('A')
x = int(input())
ans = hp(x)
ans


n = int(input())
lst = []
lst.append(n % 4)
lst.append((n + 1) % 4)
lst.append((n + 2) % 4)
if 1 in lst:
	print(str(lst.index(1)) + ' A')
elif 3 in lst:
	print(str(lst.index(3)) + ' B')
elif 2 in lst:
	print(str(lst.index(2)) + ' C')


n = int(input())
a = []
for i in range(3):
	temp = n + i
	x = temp // 4
	y = temp - 4 * x
	if y == 0:
		a.append(['D', i])
	if y == 1:
		a.append(['A', i])
	if y == 2:
		a.append(['C', i])
	if y == 3:
		a.append(['B', i])
a.sort()
print(a[0][1], a[0][0])


x = int(input(''))
actual_rank = ''
if x % 4 == 0:
	actual_rank = 'D'
elif (x - 1) % 4 == 0:
	actual_rank = 'A'
elif (x - 2) % 4 == 0:
	actual_rank = 'C'
elif (x - 3) % 4 == 0:
	actual_rank = 'B'
if actual_rank == 'A':
	print(str(0) + ' A')
elif actual_rank == 'D':
	print(str(1) + ' A')
elif actual_rank == 'C':
	print(str(1) + ' B')
else:
	print(str(2) + ' A')


xx = int(input())
mod = xx % 4
if mod == 0:
	print(1, 'A')
elif mod == 1:
	print(0, 'A')
elif mod == 2:
	print(1, 'B')
else:
	print(2, 'A')


n = int(input())
c = n % 4
a = [0, 2, 3, 1]
b = ['D', 'C', 'B', 'A']
max_1 = 0
max_2 = 0
if c == 1:
	print(0, 'A')
else:
	for i in range(3):
		c = (n + i) % 4
		if max_1 < a.index(c):
			max_1 = a.index(c)
			max_2 = i
	print(max_2, b[max_1])


def abcd():
	num = int(input())
	mod = num % 4
	if mod == 0:
		print('1 A')
	elif mod == 1:
		print('0 A')
	elif mod == 2:
		print('1 B')
	else:
		print('2 A')
abcd()


n = int(input())
d = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
l = [d[i % 4] for i in range(n, n + 3)]
print(l.index(min(l)), min(l))


print(' '.join(['1A', '0A', '1B', '2A'][int(input()) % 4]))


number = int(input())
num = number // 4
first = []
number1 = number
for i in range(3):
	number1 += i
	num = number1 // 4
	a = num * 4 + 1
	b = num * 4 + 3
	c = num * 4 + 2
	d = num * 4
	if number <= a <= number + i:
		first.append('A')
	elif number <= b <= number + i:
		first.append('B')
	elif number <= c <= number + i:
		first.append('C')
	elif number <= d <= number + i:
		first.append('D')
if 'A' in first:
	print(first.index('A'), 'A')
elif 'B' in first:
	print(first.index('B'), 'B')
elif 'C' in first:
	print(first.index('C'), 'C')
elif 'D' in first:
	print(first.index('D'), 'D')


t = int(input()) & 3
a = [1, 3, 2, 0]
for i in range(4):
	d = a[i] - t + 4 & 3
	if d < 3:
		print(d, chr(65 + i))
		break


n = int(input()) % 4
print('%d %s' % (1, 'B')) if n == 2 else print('%d %s' % (abs(1 - n), 'A'))


k = int(input())
if k % 4 == 1:
	print(str(0) + ' A')
elif k % 4 == 2:
	print(str(1) + ' B')
elif k % 4 == 3:
	print(str(2) + ' A')
elif k % 4 == 0:
	print(str(1) + ' A')
1


variants = {0: (1, 'A'), 1: (0, 'A'), 2: (1, 'B'), 3: (2, 'A')}
x = int(input().rstrip())
(add, result) = variants[x % 4]
print('{} {}'.format(add, result))


p = int(input())
q = str(p % 4)
r = str((p + 1) % 4)
s = str((p + 2) % 4)
array = ''
array = q + r + s
if str(1) in array:
	e = array.find('1')
	print(e, 'A')
elif str(3) in array:
	e = array.find('3')
	print(e, 'B')
elif str(2) in array:
	e = array.find('2')
	print(e, 'C')
else:
	print(0, 'D')


n = int(input())
ans = []
for i in range(3):
	x = (n + i) % 4
	if x == 0:
		ans.append(['D', i])
	elif x == 1:
		ans.append(['A', i])
	elif x == 2:
		ans.append(['C', i])
	else:
		ans.append(['B', i])
ans.sort()
ans[0].reverse()
for i in ans[0]:
	print(i, end=' ')


x = int(input())
if x >= 30 and x <= 100:
	xar = {1: 1, 3: 2, 2: 3, 0: 4}
	xar1 = {1: 'A', 2: 'B', 3: 'C', 4: 'D'}
	y = x % 4
	maxi = xar[y]
	k = 0
	y1 = y
	for i in range(3):
		if xar[(y + i) % 4] < xar[y1 % 4]:
			k = i
			maxi = xar[(y + i) % 4]
			y1 = (y + i) % 4
	print(k, xar1[maxi])


n = int(input()) - 1
print('0121'[n % 4], 'ABAA'[n % 4])


n = int(input())
print(*reversed(min((('DACB'[(n + x) % 4], x) for x in range(3)))))


x = int(input())
a = []
for i in range(3):
	a.append(i)
	if (x + i) % 4 == 0:
		a.append('D')
	elif (x + i) % 4 == 2:
		a.append('C')
	elif (x + i) % 4 == 3:
		a.append('B')
	else:
		a.append('A')
for w in range(1, len(a), 2):
	if a[w] == 'A':
		print(a[w - 1], a[w])
	elif a[w] == 'B' and 'A' not in a:
		print(a[w - 1], a[w])
	elif a[w] == 'C' and 'A' not in a and ('B' not in a):
		print(a[w - 1], a[w])
	elif a[w] == 'D' and 'A' not in a and ('B' not in a) and ('C' not in a):
		print(a[w - 1], a[w])


n = int(input())
m = n % 4 - 1
print('0 A' if m == 0 else '1 B' if m == 1 else '2 A' if m == 2 else '1 A')


def main():
	x = int(input())
	vals = [0] * 4
	vals[0] = 'D'
	vals[1] = 'A'
	vals[2] = 'C'
	vals[3] = 'B'
	val1 = ord(vals[x % 4])
	val2 = ord(vals[(x + 1) % 4])
	val3 = ord(vals[(x + 2) % 4])
	if val1 == min(val1, val2, val3):
		print(0, vals[x % 4])
	elif val2 == min(val1, val2, val3):
		print(1, vals[(x + 1) % 4])
	elif val3 == min(val1, val2, val3):
		print(2, vals[(x + 2) % 4])
main()


s = int(input())
r = s % 4
if r == 0:
	print(1, 'A')
elif r == 1:
	print(0, 'A')
elif r == 2:
	print(1, 'B')
else:
	print(2, 'A')


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
x = int(input())
if x % 4 == 0:
	print(1, 'A')
elif x % 4 == 1:
	print(0, 'A')
elif x % 4 == 2:
	print(1, 'B')
else:
	print(2, 'A')


plus = [[1, 'A'], [0, 'A'], [1, 'B'], [2, 'A']]
a = int(input())
print(plus[a % 4][0], plus[a % 4][1])


d = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
n = int(input())
L = list()
for i in range(3):
	num = (n + i) % 4
	L.append((d[num], i))
ans = min(L)
print(ans[-1], ans[0])


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [[0, 1], [0, -1], [1, 0], [1, -1]]
NEIGHBOURS = [(i, j) for i in range(-1, 2) for j in range(-1, 2) if i != 0 or j != 0]
OrdUnicode_a = ord('a')
OrdUnicode_A = ord('A')
CAPS_ALPHABETS = {chr(i + OrdUnicode_A): i for i in range(26)}
SMOL_ALPHABETS = {chr(i + OrdUnicode_a): i for i in range(26)}
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0) + 1
INFINITY = float('inf')
N = int(input())
ans = [['1', 'A'], ['0', 'A'], ['1', 'B'], ['2', 'A']]
print(*ans[N % 4])


x = int(input())
if 30 <= x <= 100:
	if x % 4 == 1:
		print(0, 'A')
	elif x % 4 == 2:
		print(1, 'B')
	elif x % 4 == 3:
		print(2, 'A')
	elif x % 4 == 0:
		print(1, 'A')
else:
	print('Wrong value of x')


def rem(x):
	r = x % 4
	d = {0: 'D', 1: 'A', 2: 'C', 3: 'B'}
	return d[r]
x = int(input())
cat = rem(x)
k = 0
for i in range(1, 3):
	cat1 = rem(x + i)
	if cat1 < cat:
		k = i
		cat = cat1
print(str(k) + ' ' + cat)


n = int(input())
l = [(1, 'A'), (0, 'A'), (1, 'B'), (2, 'A')]
print(*l[n % 4])


n = int(input())
a = 0
b = 'A'
if n % 4 == 0:
	a = 1
	b = 'A'
elif n % 4 == 1:
	a = 0
	b = 'A'
elif n % 4 == 2:
	a = 1
	b = 'B'
elif n % 4 == 3:
	a = 2
	b = 'A'
print(a, b)


from sys import stdin, stdout
M = 10 ** 9 + 7
for _ in range(1):
	n = int(stdin.readline())
	rem = n % 4
	if rem == 0:
		print(1, 'A')
	elif rem == 3:
		print(2, 'A')
	elif rem == 2:
		print(1, 'B')
	else:
		print(0, 'A')


n = int(input())
hp_dic = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
if hp_dic[n % 4] == 'A':
	print(0, 'A')
elif hp_dic[n % 4] == 'B':
	print(2, 'A')
elif hp_dic[n % 4] == 'C':
	print(1, 'B')
else:
	print(1, 'A')


N = int(input())
k = N % 4
if k == 1:
	print(0, 'A', sep=' ')
elif k == 2:
	print(1, 'B', sep=' ')
elif k == 3:
	print(2, 'A', sep=' ')
elif k == 0:
	print(1, 'A', sep=' ')


val = int(input())
mod = val % 4
if mod is 0:
	print('1 A')
elif mod is 1:
	print('0 A')
elif mod is 2:
	print('1 B')
else:
	print('2 A')


n = int(input())
cl = ['A', 'A', 'B', 'A']
il = [1, 0, 1, 2]
print(il[n % 4], cl[n % 4])


val = int(input())
if val % 4 == 1:
	print('0 A')
elif val % 4 == 3:
	t = val + 1
	bl = False
	if t % 4 == 1:
		print('1 A')
		bl = True
	else:
		t = t + 1
		if t % 4 == 1:
			print('2 A')
			bl = True
	if bl == False:
		print('0 B')
elif val % 4 == 2:
	t = val + 1
	bl = False
	if t % 4 == 1:
		print('1 A')
		bl = True
	else:
		t = t + 1
		if t % 4 == 1:
			print('2 A')
			bl = True
	if bl == False:
		t = val + 1
		if t % 4 == 3:
			print('1 B')
			bl = True
		else:
			t += 1
			if t % 4 == 3:
				print('2 B')
				bl = True
		if bl == False:
			print('0 C')
elif val % 4 == 0:
	t = val + 1
	bl = False
	if t % 4 == 1:
		print('1 A')
		bl = True
	else:
		t = t + 1
		if t % 4 == 1:
			print('2 A')
			bl = True
	if bl == False:
		t = val + 1
		if t % 4 == 3:
			print('1 B')
			bl = True
		else:
			t += 1
			if t % 4 == 3:
				print('2 B')
				bl = True
	if bl == False:
		t = val + 1
		if t % 4 == 2:
			print('1 C')
			bl = True
		else:
			t += 1
			if t % 4 == 2:
				print('2 C')
				bl = True
	if bl == False:
		print('0 D')


n = int(input())
x = n % 4
if not x % 2:
	x = 1
else:
	x = n % 4 - 1
n += x
n = n % 4
print(x, 'DACB'[n])


c = 'DACB'
x = int(input())
r = [(a, c[(x + a) % 4]) for a in range(3)]
b = min(r, key=lambda a: a[1])
print(*b)


n = int(input())
a = ['1 A', '0 A', '1 B', '2 A']
print(a[n % 4])


a = (3, 0, 2, 1)
b = int(input()) % 4
(x, y) = (0, 4)
for i in (0, 1, 2):
	t = a[(b + i) % 4]
	if t < y:
		(x, y) = (i, t)
print(x, 'ABCD'[y])


x = int(input())

def cat(n):
	if n % 4 == 0:
		return 'D'
	if n % 4 == 2:
		return 'C'
	if n % 4 == 3:
		return 'B'
	if n % 4 == 1:
		return 'A'
cats = ['D', 'C', 'B', 'A']
a = 0
ans = cat(x + 0)
if cats.index(cat(x + 1)) > cats.index(ans):
	ans = cat(x + 1)
	a = 1
if cats.index(cat(x + 2)) > cats.index(ans):
	ans = cat(x + 2)
	a = 2
print(a, ans)


num = int(input())
result = [(0, 'A'), (1, 'B'), (2, 'A'), (1, 'A')][(num - 1) % 4]
print(result[0], result[1])


number = int(input())
a = 1
b = 3
c = 2
d = 0
rem = number % 4
if rem == 0:
	number = number + 1
	print(1, 'A')
elif rem == 1:
	print(0, 'A')
elif rem == 2:
	number = number + 1
	print(1, 'B')
else:
	number = number + 2
	print(2, 'A')


categories = ['A', 'B', 'C', 'D']
hp = int(input().strip())
remainder = hp % 4
if remainder == 0:
	print(remainder + 1, 'A')
elif remainder == 1:
	print(0, 'A')
elif remainder == 2:
	print(1, 'B')
else:
	print(2, 'A')


a = int(input())
result_dict = {'A': -1, 'B': -1, 'C': -1, 'D': -1}

def trans(i):
	result = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
	return result.get(i)
for x in range(0, 3):
	group = trans((x + a) % 4)
	result_dict[group] = x
if result_dict['A'] > -1:
	print(result_dict['A'], ' A')
else:
	print(result_dict['B'], ' B')


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def read_string():
	return sys.stdin.readline().strip()

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l, delim=' '):
	print(delim.join(map(str, l)))

def category(a):
	if a % 4 == 1:
		return 'A'
	elif a % 4 == 3:
		return 'B'
	elif a % 4 == 2:
		return 'C'
	return 'D'
n = read_int()
cats = {}
cats[category(n + 0)] = 0
cats[category(n + 1)] = 1
cats[category(n + 2)] = 2
if 'A' in cats:
	print(cats['A'], 'A')
elif 'B' in cats:
	print(cats['B'], 'B')
elif 'C' in cats:
	print(cats['C'], 'C')
else:
	print(cats['D'], 'D')


from collections import defaultdict
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
n = int(input())
if n % 4 == 1:
	print('0 A')
elif n % 4 == 0:
	print('1 A')
elif n % 4 == 2:
	print('1 B')
else:
	print('2 A')


n = int(input())
d = 'Z'
t = 0
for i in range(3):
	g = n + i
	if g % 4 == 0:
		category = 'D'
	elif g % 4 == 3:
		category = 'B'
	elif g % 4 == 2:
		category = 'C'
	else:
		category = 'A'
	if ord(category) < ord(d):
		t = i
		d = category
print(t, d)


x = int(input())
a = 1
b = 3
c = 2
d = 0
n = x % 4
if n == a:
	print(0, 'A')
elif n == b:
	print(2, 'A')
elif n == c:
	print(1, 'B')
else:
	print(1, 'A')


n = int(input())
l = []
q = ['A', 'B', 'C', 'D']
l.append(n % 4)
l.append((n + 1) % 4)
l.append((n + 2) % 4)
V = 9999999
A = -9999999
for i in range(0, len(l)):
	if l[i] == 1:
		A = l[i]
		B = i
		break
	elif l[i] == 3 and A != 1:
		A = l[i]
		B = i
	elif l[i] == 2 and A != 1 and (A != 3):
		A = l[i]
		B = i
	elif l[i] == 0 and A != 1 and (A != 3) and (A != 2):
		A = l[i]
		B = i
print(B, end=' ')
if A == 0:
	print('D')
elif A == 1:
	print('A')
elif A == 3:
	print('B')
elif A == 2:
	print('C')


def glev(l):
	if l % 4 == 1:
		return 4
	elif l % 4 == 3:
		return 3
	elif l % 4 == 2:
		return 2
	elif l % 4 == 0:
		return 1
	else:
		return 3 / 0
cat = ['A', 'B', 'C', 'D']
x = int(input())
xx = [glev(x), glev(x + 1), glev(x + 2)]
cc = 0
xxx = 0
for i in range(3):
	if xx[i] > xxx:
		xxx = xx[i]
		cc = i
print(cc, cat[4 - xxx])


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	n = ii()
	n %= 4
	if n == 1:
		print('0 A')
	elif n == 0:
		print('1 A')
	elif n == 2:
		print('1 B')
	else:
		print('2 A')
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


a = ['D', 'A', 'C', 'B']
d = ['D', 'C', 'B', 'A']
n = int(input())
a1 = d.index(a[(n + 0) % 4])
a2 = d.index(a[(n + 1) % 4])
a3 = d.index(a[(n + 2) % 4])
m = max(a1, a2, a3)
if a1 == m:
	print(0, d[a1])
elif a2 == m:
	print(1, d[a2])
else:
	print(2, d[a3])


Input = lambda : map(int, input().split())

def cal(x):
	if (x - 1) % 4 == 0:
		return 0
	elif (x - 3) % 4 == 0:
		return 1
	elif (x - 2) % 4 == 0:
		return 2
	else:
		return 3
x = int(input())
y = cal(x)
if y == 0:
	print(0, 'A')
elif y == 1:
	q1 = cal(x + 1)
	q2 = cal(x + 2)
	if q1 == 0:
		print(1, 'A')
	elif q2 == 0:
		print(2, 'A')
	else:
		print(0, 'B')
elif y == 2:
	q1 = cal(x + 1)
	q2 = cal(x + 2)
	if q1 == 0:
		print(1, 'A')
	elif q2 == 0:
		print(2, 'A')
	elif q1 == 1:
		print(1, 'B')
	elif q2 == 1:
		print(2, 'B')
	else:
		print(0, 'C')
else:
	q1 = cal(x + 1)
	q2 = cal(x + 2)
	if q1 == 0:
		print(1, 'A')
	elif q2 == 0:
		print(2, 'A')
	elif q1 == 1:
		print(1, 'B')
	elif q2 == 1:
		print(2, 'B')
	elif q1 == 2:
		print(1, 'C')
	elif q2 == 2:
		print(2, 'C')
	else:
		print(0, 'D')


x = int(input())
collection = ['D', 'A', 'C', 'B']
mod = x % 4
category = collection[mod]
category_ = min(collection[(x + 1) % 4], collection[(x + 2) % 4], collection[mod % 4])
print(abs(collection.index(category_) - collection.index(category)), category_)


hp = int(input())
rank = ''
max = -1
for i in range(3):
	if (hp + i) % 4 == 1:
		rank = 'A'
		max = i
	elif (hp + i) % 4 == 3 and rank != 'A':
		rank = 'B'
		max = i
	elif (hp + i) % 4 == 2 and rank != 'B' and (rank != 'A'):
		rank = 'C'
		max = i
	elif rank != 'B' and rank != 'C' and (rank != 'A'):
		rank = 'D'
		max = i
print(max, rank)


def fun(x):
	x = x % 4
	if x == 0:
		return 'D'
	elif x == 1:
		return 'A'
	elif x == 2:
		return 'C'
	else:
		return 'B'
n = int(input())
p = 0
q = fun(n)
for i in range(1, 3):
	if fun(n + i) < q:
		p = i
		q = fun(n + i)
print(p, q)


n = int(input())
rem = {0: 'D', 1: 'A', 2: 'C', 3: 'B'}
hp = {'A': 3, 'B': 2, 'C': 1, 'D': 0}
hp_opp = {0: 'D', 1: 'C', 2: 'B', 3: 'A'}
a = 0
b = hp[rem[n % 4]]
if b < hp[rem[(n + 1) % 4]]:
	a = 1
	b = hp[rem[(n + 1) % 4]]
if b < hp[rem[(n + 2) % 4]]:
	a = 2
	b = hp[rem[(n + 2) % 4]]
print(a, hp_opp[b])


def gns():
	return list(map(int, input().split()))
d = {}
d['a'] = 1
d['b'] = 3
d['c'] = 2
d['d'] = 0
d[1] = 'a'
d[3] = 'b'
d[2] = 'c'
d[0] = 'd'
x = int(input())
ans = {}
for i in range(3):
	y = (x + i) % 4
	ans[d[y]] = i
for c in ['a', 'b', 'c', 'd']:
	if c in ans.keys():
		print(ans[c], chr(ord(c) - ord('a') + ord('A')))
		quit()


import math
t = int(input())
if t % 4 == 0:
	print(1, 'A')
elif t % 4 == 1:
	print(0, 'A')
elif t % 4 == 2:
	print(1, 'B')
else:
	print(2, 'A')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def xrange(n):
	return range(1, n + 1)
MOD = 10 ** 9 + 7
INF = 10 ** 20
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
from math import gcd
import string
import heapq
(n,) = I()
ans = 'ABCD'
if n % 4 == 0:
	print(1, 'A')
elif n % 4 == 1:
	print(0, 'A')
elif n % 4 == 2:
	print(1, 'B')
else:
	print(2, 'A')


def enhancement(n):
	if n % 4 == 1:
		return '0 A'
	d = {1: '0 A', 3: '2 A', 2: '1 B', 0: '1 A'}
	return d[n % 4]
print(enhancement(int(input())))


k = ['A', 'B', 'C', 'D']
t = int(input())
rem = t % 4
if rem == 1:
	print('0 A')
elif rem == 2:
	print('1 B')
elif rem == 3:
	print('2 A')
elif rem == 0:
	print('1 A')


x = int(input())
if x % 4 == 0:
	print('%d %s' % (1, 'A'))
elif x % 4 == 1:
	print('%d %s' % (0, 'A'))
elif x % 4 == 2:
	print('%d %s' % (1, 'B'))
elif x % 4 == 3:
	print('%d %s' % (2, 'A'))


n = int(input())
r = n % 4
d = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
k = n // 4
d2 = {}
l = []
for i in range(3):
	f = r + i
	f = f % 4
	h = d[f]
	d2[h] = i
	l.append(h)
l.sort()
print(d2[l[0]], l[0])


x = int(input())
z = x % 4
if z == 1 or (x + 1) % 4 == 1 or (x + 2) % 4 == 1:
	if z == 1:
		print('0 A')
	elif (x + 1) % 4 == 1:
		print('1 A')
	elif (x + 2) % 4 == 1:
		print('2 A')
elif z == 3 or (x + 1) % 4 == 3 or (x + 2) % 4 == 3:
	if z == 3:
		print('0 B')
	elif (x + 1) % 4 == 3:
		print('1 B')
	elif (x + 2) % 4 == 3:
		print('2 B')
elif z == 2 or (x + 1) % 4 == 2 or (x + 2) % 4 == 2:
	if z == 2:
		print('0 C')
	elif (x + 1) % 4 == 2:
		print('1 C')
	elif (x + 2) % 4 == 2:
		print('2 C')
else:
	print('0 D')


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
import math

def main():
	n = getN()
	if n % 4 == 1:
		print('0 A')
	elif n % 4 == 3:
		print('2 A')
	elif n % 4 == 2:
		print('1 B')
	else:
		print('1 A')

def __starting_point():
	main()
__starting_point()


n = int(input())
d = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
li = []
for i in range(3):
	z = (n + i) % 4
	li.append(f'{i} {d[z]}')
print(sorted(li, key=lambda x: x[2])[0])


def solution(x):
	list = []
	num = x % 4
	if num == 1:
		letter = 'A'
		num = 0
	elif num == 3:
		letter = 'A'
		num = 2
	elif num == 2:
		letter = 'B'
		num = 1
	else:
		letter = 'A'
		num = 1
	list.append(num)
	list.append(letter)
	return list

def main():
	x = int(input())
	result = solution(x)
	ans = ' '.join(map(str, result))
	print(ans)
	return result
main()


n = int(input())
r = n % 4
if r == 1:
	print(str(0) + ' A')
elif r == 0:
	print(str(1) + ' A')
elif r == 2:
	print(str(1) + ' B')
else:
	print(str(2) + ' A')


N = int(input())
ans = []
for i in range(3):
	if N > 100:
		break
	cnt = N + i
	if cnt % 4 == 0:
		ans.append([i, 'D'])
	elif cnt % 4 == 1:
		ans.append([i, 'A'])
	elif cnt % 4 == 2:
		ans.append([i, 'C'])
	else:
		ans.append([i, 'B'])
ans = sorted(ans, key=lambda x: x[1])
print(*ans[0])


x = int(input())
if x % 4 == 1 or x % 4 == 3 or x % 4 == 0:
	print(abs(x % 4 - 1), 'A')
else:
	print(1, 'B')


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def get_grade(x):
	if x % 4 == 1:
		return 3
	if x % 4 == 3:
		return 2
	if x % 4 == 2:
		return 1
	if x % 4 == 0:
		return 0

def get_letter(g):
	if g == 3:
		return 'A'
	if g == 2:
		return 'B'
	if g == 1:
		return 'C'
	if g == 0:
		return 'D'

def find_max(x):
	cg = get_grade(x)
	max_g = -1
	max_i = -1
	for i in range(3):
		g = get_grade(x + i)
		if max_g < g:
			max_i = i
			max_g = g
	return (max_i, get_letter(max_g))
x = int(input())
print(*find_max(x))


import sys
nums = [0, 1, 2]
a = int(input())
for i in nums:
	if (a + i) % 4 == 1:
		print(str(i) + ' A')
		exit()
for i in nums:
	if (a + i) % 4 == 3:
		print(str(i) + ' B')
		exit()
for i in nums:
	if (a + i) % 4 == 2:
		print(str(i) + ' C')
		exit()
for i in nums:
	if (a + i) % 4 == 0:
		print(str(i) + ' D')


def get_category(hp):
	A = hp % 4 == 1
	B = hp % 4 == 3
	C = hp % 4 == 2
	D = hp % 4 == 0
	if A:
		return 'A'
	if B:
		return 'B'
	if C:
		return 'C'
	else:
		return 'D'
hp = int(input())
current_category = get_category(hp)
new_c1 = get_category(hp + 1)
new_c2 = get_category(hp + 2)
if current_category == 'A':
	print('0 A')
elif current_category == 'B':
	if new_c1 == 'A':
		print('1 A')
	elif new_c2 == 'A':
		print('2 A')
	else:
		print('0 B')
elif current_category == 'C':
	if new_c1 == 'A':
		print('1 A')
	elif new_c1 == 'B':
		print('1 B')
	elif new_c2 == 'A':
		print('2 A')
	elif new_c2 == 'B':
		print('2 B')
	else:
		print('0 C')
elif current_category == 'D':
	if new_c1 == 'A':
		print('1 A')
	elif new_c1 == 'B':
		print('1 B')
	elif new_c1 == 'C':
		print('1 C')
	elif new_c2 == 'A':
		print('2 A')
	elif new_c2 == 'B':
		print('2 B')
	elif new_c2 == 'C':
		print('2 C')
	else:
		print('0 D')


import math
import sys
import collections

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
n = ii()
if n % 4 == 1:
	print('0 A')
elif n % 4 == 3:
	print('2 A')
elif n % 4 == 2:
	print('1 B')
else:
	print('1 A')


def cat(n):
	cur_cat = str()
	if n % 4 == 1:
		cur_cat = 'A'
	elif n % 4 == 3:
		cur_cat = 'B'
	elif n % 4 == 2:
		cur_cat = 'C'
	elif n % 4 == 0:
		cur_cat = 'D'
	return cur_cat
n = int(input())
y = n % 4
best_cat = min(cat(n), cat(n + 1), cat(n + 2))
num = int()
if best_cat == cat(n):
	num = 0
elif best_cat == cat(n + 1):
	num = 1
elif best_cat == cat(n + 2):
	num = 2
print(num, best_cat)


n = int(input())
levels = 'DACB'
if not n % 4 == 1:
	print(n % 4 // 3 + 1, levels[(n + (n % 4 // 3 + 1)) % 4])
else:
	print(0, levels[n % 4])


order = [1, 3, 2, 0]
category = ['D', 'A', 'C', 'B']

def better(x, y):
	x = (x % 4 + 4) % 4
	y = (y % 4 + 4) % 4
	return order.index(x) < order.index(y)

def getCategory(n):
	return category[(n % 4 + 4) % 4]
n = int(input())
best = n
x = n
for i in range(3):
	if better(x, best):
		best = x
	x += 1
print(best - n, getCategory(best))


n = int(input())
x = n % 4
dict1 = {'1': 'A', '2': 'C', '3': 'B', '0': 'D'}
dict2 = {'A': 4, 'C': 2, 'B': 3, 'D': 1}
array = []
y = x + 1
y %= 4
array.append(dict1[str(y)])
y = x + 2
y %= 4
array.append(dict1[str(y)])
i = 0
if dict2[array[i]] > dict2[dict1[str(x)]] and dict2[array[i]] > dict2[array[i + 1]]:
	print(1, array[i])
elif dict2[array[i + 1]] > dict2[dict1[str(x)]] and dict2[array[i + 1]] > dict2[array[i]]:
	print(2, array[i + 1])
else:
	print(0, dict1[str(x)])


import math
from collections import Counter
n = int(input())
a = n % 4
if a == 1:
	print(0, 'A')
elif a == 2:
	print(1, 'B')
elif a == 3:
	print(2, 'A')
elif a == 0:
	print(1, 'A')


def cal(x):
	x %= 4
	if x is 0:
		return f'1 A'
	elif x is 1:
		return f'0 A'
	elif x is 2:
		return f'1 B'
	elif x is 3:
		return f'2 A'
x = int(input())
print(cal(x))


p = input()
p = int(p) % 4
ans = ['1 A', '0 A', '1 B', '2 A']
print(ans[p])


HP = ['D', 'A', 'C', 'B']
x = int(input())
index = 0
s = HP[x % 4]
for i in range(1, 3):
	t = (x + i) % 4
	if HP[t] < s:
		index = i
		s = HP[t]
print(index, s, sep=' ')


def findChar(n):
	n = n % 4
	if n == 0:
		return 'D'
	elif n == 1:
		return 'A'
	elif n == 2:
		return 'C'
	elif n == 3:
		return 'B'
a = 'Z'
b = 0
d = int(input())
for i in range(d, d + 3):
	w = findChar(i)
	if w < a:
		a = w
		b = i - d
print(str(b) + ' ' + a, end='')


N = int(input())
print('1 B' if N % 4 == 2 else str(abs(1 - N % 4)) + ' A')


x = int(input())
v_l = [1, 3, 2, 0]
r_l = ['A', 'B', 'C', 'D']
c_l = []
mod = x % 4
for i in v_l:
	c_l.append((i - mod) % 4)
	if (i - mod) % 4 != 3:
		break
print(c_l[-1], r_l[v_l.index(i)])


import time

def getHighestCategory(health):
	cat_0 = determineCategory(health)
	cat_1 = determineCategory(health + 1)
	cat_2 = determineCategory(health + 2)
	increment = 0
	category = ''
	if min(cat_0, cat_1, cat_2) == cat_0:
		increment = 0
		category = cat_0
	if min(cat_0, cat_1, cat_2) == cat_1:
		increment = 1
		category = cat_1
	if min(cat_0, cat_1, cat_2) == cat_2:
		increment = 2
		category = cat_2
	return (increment, category)

def determineCategory(n):
	if n % 4 == 1:
		category = 'A'
	if n % 4 == 3:
		category = 'B'
	if n % 4 == 2:
		category = 'C'
	if n % 4 == 0:
		category = 'D'
	return category

def solve():
	hpoints = int(input())
	(incr, cat) = getHighestCategory(hpoints)
	print('%d %s' % (incr, cat))
solve()


x = int(input().strip())
if x % 4 == 0:
	print('{0} A'.format(1))
if x % 4 == 1:
	print('{0} A'.format(0))
if x % 4 == 2:
	print('{0} B'.format(1))
if x % 4 == 3:
	print('{0} A'.format(2))


number = int(input())

def func2(num):
	if num == 1:
		return 'A'
	elif num == 3:
		return 'B'
	elif num == 2:
		return 'C'
	else:
		return 'D'
	return 0
rem0 = number % 4
rem1 = (number + 1) % 4
rem2 = (number + 2) % 4
l = [(0, func2(rem0)), (1, func2(rem1)), (2, func2(rem2))]

def func1(tup):
	return tup[1]
l.sort(key=func1)
print('{} {}'.format(l[0][0], l[0][1]))


def HpUpgrade(hp):
	if hp % 4 == 1:
		return (0, 'A')
	elif hp % 4 == 0:
		return (1, 'A')
	elif hp % 4 == 2:
		return (1, 'B')
	elif hp % 4 == 3:
		return (2, 'A')
hp = int(input())
(res, b) = HpUpgrade(hp)
print(str(res) + ' ' + b.upper())


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math
import heapq

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
x = intIn()
m = x % 4
if m == 0:
	print(1, 'A')
elif m == 2:
	print(1, 'B')
elif m == 3:
	print(2, 'A')
else:
	print(0, 'A')


dct = {1: ['A', 0], 3: ['B', 2], 2: ['C', 1], 0: ['D', 1]}

def upgrade(n):
	x = n % 4
	_next = dct[x][1]
	return (_next, dct[(x + _next) % 4][0])
n = int(input())
(x, y) = upgrade(n)
print(x, y)


n = int(input())
arr = ['D', 'A', 'C', 'B']
modulo = n % 4
counter = 0
for i in range(1, 3):
	if arr[(n + i) % 4] < arr[modulo]:
		modulo = (n + i) % 4
		counter = i
print(counter, arr[modulo])


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007
yp = 0

def countDivisibles(A, B, M):
	if A % M == 0:
		return B / M - A / M + 1
	return B / M - A / M

def solve():
	t = 1
	for tt in range(t):
		n = nu()
		x = n % 4
		y = (n + 1) % 4
		z = (n + 2) % 4
		mp = {0: 'D', 1: 'A', 3: 'B', 2: 'C'}
		pp = [(mp[x], 0), (mp[y], 1), (mp[z], 2)]
		pp.sort()
		print(pp[0][1], pp[0][0])
solve()


def incr(n):
	best = 'D'
	res = n
	p = n
	for i in range(3):
		temp = n % 4
		if temp == 1:
			best = 'A'
			res = n
			break
		elif temp == 2:
			if best > 'C':
				best = 'C'
				res = n
		elif temp == 3:
			if best > 'B':
				best = 'B'
				res = n
		n += 1
	return (str(abs(res - p)), best)
x = int(input().strip())
print(' '.join(incr(x)))


k = int(input())
k = k % 4
a = {0: '1 A', 1: '0 A', 2: '1 B', 3: '2 A'}
print(a[k])


n = int(input())
res = ['1 A', '0 A', '1 B', '2 A']
print(res[n % 4])


hp = int(input())
d = {1: 'A', 0: 'D', 3: 'B', 2: 'C'}
moves = [0, 1, 2]
output = []
o = {}
for i in moves:
	t = hp + i
	key = t % 4
	output.append(d[key])
	o[d[key]] = i
print(str(o[min(output)]) + ' ' + str(min(output)))


s = int(input())
t = int(s % 4)
c = 0
if t == 1:
	print('0' + ' ' + 'A')
elif t == 3:
	print('2' + ' ' + 'A')
elif t == 2:
	print('1' + ' ' + 'B')
else:
	print('1' + ' ' + 'A')


categories = {0: 'D', 2: 'C', 3: 'B', 1: 'A'}
x = int(input())
category = x % 4
if category == 0:
	print('1 A')
elif category == 1:
	print('0 A')
elif category == 2:
	print('1 B')
else:
	print('2 A')


A = 4
B = 3
C = 2
D = 1
sost = -1
hp = int(input())
sosthp = hp % 4
if sosthp == 0:
	sost = D
elif sosthp == 1:
	sost = A
elif sosthp == 2:
	sost = C
else:
	sost = B
if sost == A:
	print('0 A')
elif sosthp + 1 == 1 and sost == D:
	print('1 A')
elif sosthp + 1 == 3 and sost == C:
	print('1 B')
elif sosthp + 2 == 5 and sost == B:
	print('2 A')


rem = [1, 3, 2, 0]
n = int(input())
ans = []
for i in range(3):
	c = (n + i) % 4
	k = rem.index(c, 0, len(rem))
	ans.append([k, i])
ans.sort()
(a, b) = (ans[0][0], ans[0][1])
if rem[a] == 1:
	print(b, 'A')
if rem[a] == 3:
	print(b, 'B')
if rem[a] == 2:
	print(b, 'C')
if rem[a] == 0:
	print(b, 'D')


def category(hp):
	if hp % 4 == 1:
		return 'A'
	if hp % 4 == 3:
		return 'B'
	if hp % 4 == 2:
		return 'C'
	if hp % 4 == 0:
		return 'D'
	return None

def level(hp):
	if hp % 4 == 1:
		return 4
	if hp % 4 == 3:
		return 3
	if hp % 4 == 2:
		return 2
	if hp % 4 == 0:
		return 1
	return None
x = int(input())
(a, b, l) = (0, category(x), level(x))
(a1, b1, l1) = (1, category(x + 1), level(x + 1))
if l1 > l:
	(a, b, l) = (a1, b1, l1)
(a2, b2, l2) = (2, category(x + 2), level(x + 2))
if l2 > l:
	(a, b, l) = (a2, b2, l2)
print(a, b)


import sys
input = sys.stdin.readline
n = int(input())
r = n % 4
if r == 1:
	print(0, 'A')
elif r == 2:
	print(1, 'B')
elif r == 3:
	print(2, 'A')
else:
	print(1, 'A')


import sys
import math
import bisect

def main():
	x = int(input())
	A = [x % 4, (x + 1) % 4, (x + 2) % 4]
	if 1 in A:
		for i in range(3):
			if A[i] == 1:
				print('%d A' % i)
	elif 3 in A:
		for i in range(3):
			if A[i] == 3:
				print('%d B' % i)
	elif 2 in A:
		for i in range(3):
			if A[i] == 2:
				print('%d C' % i)
	elif 4 in A:
		for i in range(3):
			if A[i] == 4:
				print('%d D' % i)
main()


n = int(input())

def rank(n):
	if n % 4 == 1:
		return 1
	elif n % 4 == 3:
		return 2
	elif n % 4 == 2:
		return 3
	else:
		return 4
rank_n = [(rank(n + x), x) for x in range(3)]
rank_n.sort()
res = rank_n[0]
if res[0] == 1:
	ress = (res[1], 'A')
elif res[0] == 2:
	ress = (res[1], 'B')
elif res[0] == 3:
	ress = (res[1], 'C')
else:
	ress = (res[1], 'D')
print('{} {}'.format(ress[0], ress[1]))


x = int(input())
mod = x % 4
if mod == 0:
	current = 'D'
	print('1 A')
elif mod == 1:
	current = 'A'
	print('0 A')
elif mod == 2:
	current = 'C'
	print('1 B')
elif mod == 3:
	current = 'B'
	print('2 A')


from sys import stdin
input = stdin.readline
x = int(input())
b = [1, 3, 2, 0]
c = ['A', 'B', 'C', 'D']
t = float('inf')
k = b.index(x % 4)
if k < t:
	p = x
	t = k
k = b.index((x + 1) % 4)
if k < t:
	p = x + 1
	t = k
k = b.index((x + 2) % 4)
if k < t:
	p = x + 2
	t = k
print(p - x, c[t])


hp = int(input())
category = ''
inc = ''
for i in range(3):
	if (hp + i) % 4 == 1:
		category = 'A'
		inc = i
	elif (hp + i) % 4 == 3:
		if category != 'A':
			category = 'B'
			inc = i
	elif (hp + i) % 4 == 2:
		if category != 'A' and category != 'B':
			category = 'C'
			inc = i
	elif (hp + i) % 4 == 0:
		if category != 'A' and category != 'B' and (category != 'C'):
			category = 'D'
			inc = i
print(inc, category)


x = int(input())
r = x % 4
if r == 1:
	a = 0
	b = 'A'
elif r == 2:
	a = 1
	b = 'B'
elif r == 3:
	a = 2
	b = 'A'
else:
	a = 1
	b = 'A'
print(a, end=' ')
print(b)


dic = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
n = int(input())
sum1 = 0
stri = dic[n % 4]
for j in range(3):
	k = (n + j) % 4
	if stri > dic[(n + j) % 4]:
		sum1 = j
		stri = dic[k]
if stri == '':
	print(sum1, dic[n % 4])
else:
	print(sum1, stri)


from sys import *
n = int(stdin.readline())
x = n % 4
if x == 1:
	print(0, 'A')
if x == 0:
	print(1, 'A')
if x == 2:
	print(1, 'B')
if x == 3:
	print(2, 'A')


x = int(input())
hp = ['D', 'A', 'C', 'B']
if x % 4 == 0:
	a = 1
	b = 1
if x % 4 == 1:
	a = 0
	b = 1
if x % 4 == 2:
	a = 1
	b = 3
if x % 4 == 3:
	a = 2
	b = 1
print(a, hp[b])


def tek(n):
	ch = 'A' if n % 4 == 1 else 'B' if n % 4 == 3 else 'C' if n % 4 == 2 else 'D'
	return ch
n = int(input())
if tek(n) == 'A':
	print(0, tek(n))
elif tek(n + 1) == 'A':
	print(1, tek(n + 1))
elif tek(n + 2) == 'A':
	print(2, tek(n + 2))
elif tek(n) == 'B':
	print(0, tek(n))
elif tek(n + 1) == 'B':
	print(1, tek(n + 1))
elif tek(n + 2) == 'B':
	print(2, tek(n + 2))
elif tek(n) == 'C':
	print(0, tek(n))
elif tek(n + 1) == 'C':
	print(1, tek(n + 1))
elif tek(n + 2) == 'C':
	print(2, tek(n + 2))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : list(map(int, input().split()))
I = lambda : int(input())
n = I()
if n % 4 == 0:
	print(1, 'A')
if n % 4 == 1:
	print(0, 'A')
if n % 4 == 2:
	print(1, 'B')
if n % 4 == 3:
	print(2, 'A')


def Tokitsukaze():
	n = int(input())
	r = n % 4
	if r == 1:
		print('0 A')
	elif r == 2:
		print('1 B')
	elif r == 3:
		print('2 A')
	else:
		print('1 A')
Tokitsukaze()


l = [1, 0, 1, 2]
d = ['A', 'A', 'B', 'A']
n = int(input())
x = n % 4
print(l[x], d[x])


n = int(input())
c = 'A'
r = 0
mod = n % 4
if mod == 2:
	r = 1
	c = 'B'
elif mod == 3:
	r = 2
elif mod == 0:
	r = 1
print(r, c)


q = int(input())
c = q % 4
if c == 1:
	print('0 A')
elif c == 3:
	print('2 A')
elif c == 2:
	print('1 B')
else:
	print('1 A')


n = int(input())
l = 0
d = int(n % 4)
if d == 0:
	l = 1
elif d == 1:
	l = 4
elif d == 2:
	l = 2
else:
	l = 3
m = n
kq = n
for i in range(2):
	t = 0
	m = n + i + 1
	d = int(m % 4)
	if d == 0:
		t = 1
	elif d == 1:
		t = 4
	elif d == 2:
		t = 2
	else:
		t = 3
	if t > l:
		l = t
		kq = m
if l == 4:
	m = 'A'
elif l == 1:
	m = 'D'
elif l == 2:
	m = 'C'
else:
	m = 'B'
print(kq - n, m)


HP = int(input())
rest = HP % 4
ausgabe = 0
buchstabe = ''
if rest == 0:
	ausgabe = 1
	buchstabe = 'A'
elif rest == 1:
	ausgabe = 0
	buchstabe = 'A'
elif rest == 2:
	ausgabe = 1
	buchstabe = 'B'
elif rest == 3:
	ausgabe = 2
	buchstabe = 'A'
print(ausgabe, buchstabe)


x = int(input())
a = 0
b = 'A'
if x % 4 == 2:
	a = 1
	b = 'B'
elif x % 4 == 3:
	a = 2
elif x % 4 == 0:
	a = 1
print(a, b, sep=' ')


(n, ans1, ans2, anss) = (int(input()), 0, 0, ['D', 'C', 'B', 'A'])
for i in range(0, 3):
	if (n + i) % 4 == 1:
		ans1 = i
		ans2 = 3
		break
	elif (n + i) % 4 == 3 and ans2 < 2:
		ans1 = i
		ans2 = 2
	elif (n + 1) % 4 == 2 and ans2 < 1:
		ans1 = i
		ans2 = 1
print(ans1, anss[ans2])


def solve():
	x = int(input())
	if x % 4 == 2:
		print(1, 'B')
	else:
		print(abs(1 - x % 4), 'A')
solve()


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s
n = ii()
x = n % 4
if x == 0:
	print('1 A')
elif x == 1:
	print('0 A')
elif x == 2:
	print('1 B')
elif x == 3:
	print('2 A')


import sys
n = int(input())
hp = 'DACB'
if n % 4 == 1:
	print(0, 'A')
elif n % 4 == 0:
	print(1, 'A')
elif n % 4 == 2:
	print(1, 'B')
elif n % 4 == 3:
	print(2, 'A')


n = int(input())
if n % 4 == 1:
	x = '0'
	c = 'A'
elif n % 4 == 3:
	x = '2'
	c = 'A'
elif n % 4 == 2:
	x = '1'
	c = 'B'
elif n % 4 == 0:
	x = '1'
	c = 'A'
print(x, c)


n = int(input())
ans = 0
char = 'A'
rem = n % 4
if rem == 2:
	ans = 1
	char = 'B'
elif rem == 3:
	ans = 2
	char = 'A'
elif rem == 0:
	ans = 1
	char = 'A'
print(ans, char)


hp = int(input())
remainder = hp % 4
if remainder == 0:
	print('1', 'A')
elif remainder == 2:
	print('1', 'B')
elif remainder == 3:
	print('2', 'A')
elif remainder == 1:
	print('0', 'A')


n = int(input())
remainder = n % 4
if remainder == 1:
	category = 'A'
	print(0, category)
elif remainder == 2:
	category = 'B'
	print(1, category)
elif remainder == 3:
	category = 'A'
	print(2, category)
else:
	category = 'A'
	print(1, category)


arr = ['1 A', '0 A', '1 B', '2 A']
n = int(input())
print(arr[n % 4])


def p(x):
	y = x % 4
	if y == 1:
		return 3
	if y == 3:
		return 2
	if y == 2:
		return 1
	if y == 0:
		return 0
n = int(input())
n0 = p(n)
n1 = p(n + 1)
n2 = p(n + 2)
c = ['D', 'C', 'B', 'A']
k = max(n0, n1, n2)
if k == n0:
	print('0 ' + c[n0])
if k == n1:
	print('1 ' + c[n1])
if k == n2:
	print('2 ' + c[n2])


import sys
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
readl = lambda : list(map(int, sys.stdin.readline().split()))
readt = lambda : tuple(map(int, sys.stdin.readline().split()))
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(read())
readmi = lambda : map(int, sys.stdin.readline().split())
readms = lambda : map(str, sys.stdin.readline().split())

def jdg(x):
	if x == 1:
		return 'A'
	elif x == 3:
		return 'B'
	elif x == 2:
		return 'C'
	else:
		return 'D'
n = readi()
mx = 'Z'
index = 0
for i in range(3):
	t = jdg((n + i) % 4)
	if mx > t:
		mx = t
		index = i
print(str(index) + ' ', end='')
print(mx)


n = int(input())
ans1 = 1
ans2 = 'B'
if n % 4 != 2:
	ans2 = 'A'
	if n % 4 == 1:
		ans1 = 0
	elif n % 4 == 3:
		ans1 = 2
print(ans1, ans2, sep=' ')


t = int(input())
k = t % 4
if k == 0:
	print(1, 'A')
elif k == 1:
	print(0, 'A')
elif k == 2:
	print(1, 'B')
else:
	print(2, 'A')


import sys
import math
input = sys.stdin.readline
x = int(input())
d = x % 4
if d == 1:
	print(0, 'A')
elif d == 2:
	print(1, 'B')
elif d == 3:
	print(2, 'A')
else:
	print(1, 'A')


n = int(input())
ost = n % 4
if ost == 0:
	up = 1
	char = 'A'
elif ost == 1:
	up = 0
	char = 'A'
elif ost == 2:
	up = 1
	char = 'B'
elif ost == 3:
	up = 2
	char = 'A'
print(str(up) + ' ' + char)


hp = int(input())
hp1 = hp + 1
hp2 = hp + 2
n = hp // 4
for x in range(n, hp):
	if 4 * x + 1 == hp:
		print('0 A')
		exit()
	elif 4 * x + 1 == hp1:
		print('1 A')
		exit()
	elif 4 * x + 1 == hp2:
		print('2 A')
		exit()
for x in range(n, hp):
	if 4 * x + 3 == hp:
		print('0 B')
		exit()
	elif 4 * x + 3 == hp1:
		print('1 B')
		exit()
	elif 4 * x + 3 == hp2:
		print('2 B')
		exit()
for x in range(n, hp):
	if 4 * x + 2 == hp:
		print('0 C')
		exit()
	elif 4 * x + 2 == hp1:
		print('1 C')
		exit()
	elif 4 * x + 2 == hp2:
		print('2 C')
		exit()
for x in range(n, hp):
	if 4 * x == hp:
		print('0 D')
		exit()
	elif 4 * x == hp1:
		print('1 D')
		exit()
	elif 4 * x == hp2:
		print('2 D')
		exit()


a = int(input())
l = []
for i in range(3):
	l.append((a + i) % 4)
if 1 in l:
	print(l.index(1), 'A')
elif 3 in l:
	print(l.index(3), 'B')
elif 2 in l:
	print(l.index(2), 'C')
elif 0 in l:
	print(l.index(0), 'D')


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
n %= 4
if n == 1:
	print('0 A')
elif n == 2:
	print('1 B')
elif n == 3:
	print('2 A')
else:
	print('1 A')


text = input()
c = int(text)
if c % 4 == 1:
	print('0 A')
if c % 4 == 3:
	print('2 A')
if c % 4 == 2:
	print('1 B')
if c % 4 == 0:
	print('1 A')


import sys
import math
import bisect
from collections import deque
sys.setrecursionlimit(1000000000)

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

def modst(a, s):
	res = 1
	while s:
		if s % 2:
			res *= a
		a *= a
		s //= 2
	return res

def main():
	n = iinput() % 4
	if n == 3:
		print(2, 'A')
	if n == 0:
		print(1, 'A')
	if n == 1:
		print(0, 'A')
	if n == 2:
		print(1, 'B')
for i in range(1):
	main()


from sys import stdin
n = int(stdin.readline().rstrip())
r = n % 4
if r == 1:
	print('0 A')
elif r == 2:
	print('1 B')
elif r == 0:
	print('1 A')
else:
	print('2 A')


t = int(input()) % 4
print('1012'[t], 'AABA'[t])


categories = {0: '1 A', 1: '0 A', 2: '1 B', 3: '2 A'}
print(categories[int(input()) % 4])


def f(n):
	if n % 4 == 1:
		return 'A'
	if n % 4 == 3:
		return 'B'
	if n % 4 == 2:
		return 'C'
	return 'D'

def mx(a, b, c):
	if ord(a) < ord(b) and ord(a) < ord(c):
		return [0, a]
	if ord(b) < ord(c) and ord(b) < ord(a):
		return [1, b]
	return [2, c]
n = int(input())
print(*mx(f(n), f(n + 1), f(n + 2)))


n = int(input())
a = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
b = {'A': 3, 'B': 2, 'C': 1, 'D': 0}
x = n % 4
ax1 = b[a[x]]
ax2 = b[a[(x + 1) % 4]]
ax3 = b[a[(x + 2) % 4]]
if max(ax1, ax2, ax3) == ax1:
	print(0, a[x])
if max(ax1, ax2, ax3) == ax2:
	print(1, a[(x + 1) % 4])
if max(ax1, ax2, ax3) == ax3:
	print(2, a[(x + 2) % 4])


def Tokitsukaze_and_upgrade():
	n = int(input())
	residue = n % 4
	if residue == 0:
		print('1 A')
	elif residue == 1:
		print('0 A')
	elif residue == 2:
		print('1 B')
	else:
		print('2 A')
Tokitsukaze_and_upgrade()


n = int(input())
if n % 4 == 0:
	category = 'D'
elif n % 4 == 1:
	category = 'A'
elif n % 4 == 2:
	category = 'C'
else:
	category = 'B'
if category == 'A':
	print('0 A')
elif category == 'B':
	print('2 A')
elif category == 'C':
	print('1 B')
else:
	print('1 A')


from sys import setcheckinterval, stdin
setcheckinterval(1000)
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
x = iin()
a = {1: 4, 3: 3, 2: 2, 0: 1}
ch = a[x % 4]
ans = 0
if a[(x + 1) % 4] > ch:
	ans = 1
	ch = a[(x + 1) % 4]
if a[(x + 2) % 4] > ch:
	ans = 2
	ch = a[(x + 2) % 4]
print(ans, ['A', 'B', 'C', 'D'][-ch])


from __future__ import print_function
import sys
try:
	input = raw_input
except:
	pass

def read_int_line():
	return [int(x) for x in input().split(' ')]

def read_int():
	return int(input())

class TreeNode(object):

	def __init__(self, x):
		self.val = x
		self.left = None
		self.right = None

	def __str__(self):
		q = deque()
		ans = []
		q.append(self)
		ans.append(self.val)
		while q:
			cur = q.popleft()
			ans.append(cur.left.val if cur.left else 'null')
			ans.append(cur.right.val if cur.right else 'null')
			if cur.left:
				q.append(cur.left)
			if cur.right:
				q.append(cur.right)
		while ans and ans[-1] == 'null':
			ans.pop()
		return str(ans).replace("'null'", 'null')

def toTreeNode(s):
	l = eval(s.replace('null', 'None'))
	n = len(l)
	if not n:
		return None
	root = TreeNode(l[0])
	q = deque()
	q.append(root)
	i = 1
	while q and i < n:
		cur = q.popleft()
		if l[i] != None:
			cur.left = TreeNode(l[i])
			q.append(cur.left)
		i += 1
		if i >= n:
			break
		if l[i] != None:
			cur.right = TreeNode(l[i])
			q.append(cur.right)
		i += 1
	return root

class Djs:

	def __init__(self, n):
		self.w = [1] * n
		self.p = [-1] * n

	def find(self, x):
		p = self.p[x]
		if p == -1:
			return x
		else:
			self.p[x] = self.find(p)
			return self.p[x]

	def union(self, x, y):
		(x, y) = (self.find(x), self.find(y))
		if x == y:
			return
		if self.w[x] > self.w[y]:
			(x, y) = (y, x)
		self.p[x] = y
		self.w[y] += self.w[x]

	def roots(self):
		return [x for (x, y) in enumerate(self.p) if y == -1]
n = read_int()
d = {0: '1 A', 1: '0 A', 2: '1 B', 3: '2 A'}
print('%s' % d[n % 4])


x = int(input())
n = 0
k = x % 4
nom = k
zn = 0
if k == 0:
	cat = 'D'
elif k == 2:
	cat = 'C'
elif k == 3:
	cat = 'B'
else:
	print(0, 'A')
	exit()
for i in range(3):
	k = (x + i) % 4
	if k == 1:
		print(i, 'A')
		exit()
	if k > nom:
		nom = k
		zn = i
if nom == 0:
	print(zn, 'D')
elif nom == 2:
	print(zn, 'C')
elif nom == 3:
	print(zn, 'B')


x = int(input())
a = 0
one = x + 1
two = x + 2
if x % 4 == 1:
	print(0, 'A')
elif one % 4 == 1:
	print(1, 'A')
elif two % 4 == 1:
	print(2, 'A')
elif x % 4 == 3:
	print(0, 'B')
elif one % 4 == 3:
	print(1, 'B')
elif two % 4 == 3:
	print(2, 'B')
elif x % 4 == 2:
	print(0, 'C')
elif one % 4 == 2:
	print(1, 'C')
elif two % 4 == 2:
	print(2, 'C')
elif x % 4 == 0:
	print(0, 'D')
elif one % 4 == 0:
	print(1, 'D')
elif two % 4 == 0:
	print(2, 'D')


from math import floor
n = int(input())
print(abs(n - floor(n / 4) * 4 - 1), 'B' if (n - 2) % 4 == 0 else 'A')


n = int(input())
inc = None
hp = None
if n % 4 == 1:
	inc = 0
	print('0 A')
	exit()
rem = n % 4
if rem == 3:
	inc = 2
	hp = 'A'
elif rem == 2:
	inc = 1
	hp = 'B'
elif rem == 0:
	inc = 1
	hp = 'A'
print(str(inc) + ' ' + hp)


def cat(n):
	if n % 4 == 0:
		return 'D'
	if n % 4 == 1:
		return 'A'
	if n % 4 == 2:
		return 'C'
	if n % 4 == 3:
		return 'B'
n = int(input())
l = [0, 1, 2]
catl = [cat(i + n) for i in l]
ind = catl.index(min(catl))
print(l[ind], min(catl))


lank = ['D', 'A', 'C', 'B']
hp = int(input())
hp = divmod(hp, 4)
if hp[1] == 0:
	plus = 1
	save = 1
elif hp[1] == 1:
	plus = 0
	save = 1
elif hp[1] == 2:
	plus = 1
	save = 3
elif hp[1] == 3:
	plus = 2
	save = 1
print(plus, lank[save])


while True:
	try:

		def find(x, lis):
			for i in range(4):
				if lis[i] == x:
					return i
		n = int(input())
		dic = {1: 'A', 0: 'D', 2: 'C', 3: 'B'}
		li = [0, 2, 3, 1]
		(incr, pos) = (0, 0)
		pos = find(n % 4, li)
		for i in range(2):
			n += 1
			t = pos
			pos = max(pos, find(n % 4, li))
			if t != pos:
				incr = i + 1
		print(incr, dic[li[pos]])
	except EOFError:
		break


n = int(input())
max = n % 4
ans = ''
if max == 1:
	ans = 'A'
elif max == 3:
	ans = 'B'
elif max == 2:
	ans = 'C'
else:
	ans = 'D'
count = 0
for i in range(1, 3):
	n += 1
	max = n % 4
	if max == 1:
		ans1 = 'A'
	elif max == 3:
		ans1 = 'B'
	elif max == 2:
		ans1 = 'C'
	else:
		ans1 = 'D'
	if ans1 < ans:
		ans = ans1
		count = i
print(count, ans)


x = int(input())
(x, y, z) = (x % 4, (x + 1) % 4, (x + 2) % 4)
k = 'D'
op = 2
if 1 in [x, y, z]:
	k = 'A'
	if 1 == x:
		op = 0
	elif 1 == y:
		op = 1
elif 3 in [x, y, z]:
	k = 'B'
	if 3 == x:
		op = 0
	elif 3 == y:
		op = 1
elif 2 in [x, y, z]:
	k = 'C'
	if 2 == x:
		op = 0
	elif 2 == y:
		op = 1
elif 0 in [x, y, z]:
	k = 'A'
	if 0 == x:
		op = 0
	elif 0 == y:
		op = 1
print(op, k)


n = int(input())
fin = False
if n % 4 == 1:
	print('0 A')
if n % 4 == 0:
	print('1 A')
if n % 4 == 3:
	print('2 A')
if n % 4 == 2:
	print('1 B')


x = int(input())
remain = x % 4
if remain == 2:
	print(1, 'B')
elif remain == 1 or remain == 0:
	print(1 - remain, 'A')
else:
	print(2, 'A')


n = int(input())
ans = {1: 'A', 2: 'B', 3: 'A', 0: 'A'}
ans_v = {1: 0, 2: 1, 3: 2, 0: 1}
n %= 4
print('{} {}'.format(ans_v[n], ans[n]))


import sys
n = int(sys.stdin.readline())
d = n % 4
if d == 0:
	print(1, 'A')
elif d == 1:
	print(0, 'A')
elif d == 2:
	print(1, 'B')
elif d == 3:
	print(2, 'A')


x = int(input())
r_n = {1: 4, 3: 3, 2: 2, 0: 1}
n_l = {4: 'A', 3: 'B', 2: 'C', 1: 'D'}
(max_n, max_a) = (0, 0)
for a in range(3):
	r = (x + a) % 4
	if r_n[r] > max_n:
		max_n = r_n[r]
		max_a = a
print(max_a, n_l[max_n])


n = int(input())

def func(n):
	if n % 4 == 0:
		return 'D'
	elif n % 4 == 1:
		return 'A'
	elif n % 4 == 2:
		return 'C'
	elif n % 4 == 3:
		return 'B'

def priority(a, b, c):
	temp = min(a, b, c)
	if temp == a:
		return 0
	elif temp == b:
		return 1
	else:
		return 2
(a, b, c) = (func(n), func(n + 1), func(n + 2))
print(str(priority(a, b, c)) + ' ' + str(min(a, b, c)))


n = int(input())
c = n % 4
if c == 1:
	print(str(0) + ' A')
elif c == 2:
	print(str(1) + ' B')
elif c == 3:
	print(str(2) + ' A')
else:
	print(str(1) + ' A')


def cat(mod):
	categories = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
	return categories[mod]
x = int(input())
a = 0
for i in range(1, 3):
	if cat((x + a) % 4) > cat((x + i) % 4):
		a = i
print(a, cat((x + a) % 4))


from typing import Tuple
import math

def bar(n: int) -> int:
	rem = n % 4
	if rem == 0:
		return 5
	if rem == 1:
		return 0
	if rem == 3:
		return 1
	if rem == 2:
		return 2

def foo(n: int) -> Tuple:
	result = None
	x = {5: 'D', 0: 'A', 1: 'B', 2: 'C'}
	(a, b, c) = (bar(n), bar(n + 1), bar(n + 2))
	if a < b and a < c:
		return (0, x[a])
	if b < a and b < c:
		return (1, x[b])
	if c < a and c < b:
		return (2, x[c])
	return result
n = int(input())
result = foo(n)
print(f'{result[0]} {result[1]}')


n = int(input())
x = n
y = n + 1
z = n + 2
l1 = []
l3 = []
l2 = ['D', 'A', 'C', 'B']
l3.append(l2[x % 4])
l3.append(l2[y % 4])
l3.append(l2[z % 4])
l4 = l3.copy()
l3.sort()
ans = l3[0]
ans2 = l4.index(ans)
print(ans2, ans)


def switch_case(arg):
	switcher = {1: 'A', 3: 'B', 2: 'C'}
	return switcher.get(arg, 'D')
n = int(input())
x = n % 4
if switch_case(x) == 'A':
	print('%d %s' % (0, switch_case(x)))
elif switch_case(x) == 'B':
	print('%d %s' % (2, 'A'))
elif switch_case(x) == 'C':
	print('%d %s' % (1, 'B'))
else:
	print('%d %s' % (1, 'A'))


import sys
lines = []
for Line in sys.stdin:
	lines.append(Line.rstrip('\n'))
n = int(lines[0])
del lines[0]
cats = ['D', 'C', 'B', 'A']
mods = [0, 2, 3, 1]
ind = 0
if n % 4 == 0:
	cat = 'D'
	ind = 0
elif n % 4 == 2:
	cat = 'C'
	ind = 1
elif n % 4 == 3:
	cat = 'B'
	ind = 2
elif n % 4 == 1:
	cat = 'A'
	print(0, 'A')
	exit(0)
maxi = ind
max_ind = 0
for i in range(3):
	if mods.index((n + i) % 4) > maxi:
		maxi = max(mods.index((n + i) % 4), maxi)
		max_ind = i
print(max_ind, cats[maxi])


n = int(input())
x = n % 4
if x == 1:
	print('0' + ' ' + 'A')
elif x == 3:
	for y in range(1, 3):
		if (n + y) % 4 == 1:
			print(str(y) + ' ' + 'A')
			break
elif x == 2:
	c = 0
	for y in range(1, 3):
		if (n + y) % 4 == 1:
			print(str(y) + ' ' + 'A')
			c = 1
			break
	if c == 0:
		for y in range(1, 3):
			if (n + y) % 4 == 3:
				print(str(y) + ' ' + 'B')
				break
elif x == 0:
	c = 0
	for y in range(1, 3):
		if (n + y) % 4 == 1:
			print(str(y) + ' ' + 'A')
			c = 1
			break
	if c == 0:
		for y in range(1, 3):
			if (n + y) % 4 == 3:
				print(str(y) + ' ' + 'B')
				c = 1
				break
		if c == 0:
			for y in range(1, 3):
				if (n + y) % 4 == 2:
					print(str(y) + ' ' + 'C')
					break


import sys
it = iter(sys.stdin.read().splitlines())
n = int(next(it))
cat = ['D', 'A', 'C', 'B']
remainder = n % 4
current = cat[remainder]
if current == 'A':
	print(0, 'A')
elif current == 'B':
	print(2, 'A')
elif current == 'C':
	print(1, 'B')
elif current == 'D':
	print(1, 'A')


k = {0: [1, 'A'], 1: [0, 'A'], 3: [2, 'A'], 2: [1, 'B']}
print(*k.get(int(input()) % 4))


num = int(input())
counter = 0
ost = num % 4
if ost == 0:
	num += 1
	counter += 1
	print(counter, 'A')
if ost == 3:
	num += 2
	counter += 2
	print(counter, 'A')
if ost == 2:
	num += 1
	counter += 1
	print(counter, 'B')
if ost == 1:
	counter = 0
	print(counter, 'A')


number = int(input())

def get_category(n):
	ost = n % 4
	if ost == 1:
		return 'A'
	elif ost == 3:
		return 'B'
	elif ost == 2:
		return 'C'
	else:
		return 'D'

def solution(n):
	best_cat = get_category(n)
	best_pt = 0
	for i in range(3):
		if get_category(n + i) < best_cat:
			best_cat = get_category(n + i)
			best_pt = i
	print(f'{best_pt} {best_cat}')
solution(number)


x = int(input())
if x == 30:
	print('1 B')
elif x == 31:
	print('2 A')
elif x == 32:
	print('1 A')
elif x == 33:
	print('0 A')
elif x == 34:
	print('1 B')
elif x == 35:
	print('2 A')
elif x == 36:
	print('1 A')
elif x == 37:
	print('0 A')
elif x == 38:
	print('1 B')
elif x == 39:
	print('2 A')
elif x == 40:
	print('1 A')
elif x == 41:
	print('0 A')
elif x == 42:
	print('1 B')
elif x == 43:
	print('2 A')
elif x == 44:
	print('1 A')
elif x == 45:
	print('0 A')
elif x == 46:
	print('1 B')
elif x == 47:
	print('2 A')
elif x == 48:
	print('1 A')
elif x == 49:
	print('0 A')
elif x == 50:
	print('1 B')
elif x == 51:
	print('2 A')
elif x == 52:
	print('1 A')
elif x == 53:
	print('0 A')
elif x == 54:
	print('1 B')
elif x == 55:
	print('2 A')
elif x == 56:
	print('1 A')
elif x == 57:
	print('0 A')
elif x == 58:
	print('1 B')
elif x == 59:
	print('2 A')
elif x == 60:
	print('1 A')
elif x == 61:
	print('0 A')
elif x == 62:
	print('1 B')
elif x == 63:
	print('2 A')
elif x == 64:
	print('1 A')
elif x == 65:
	print('0 A')
elif x == 66:
	print('1 B')
elif x == 67:
	print('2 A')
elif x == 68:
	print('1 A')
elif x == 69:
	print('0 A')
elif x == 70:
	print('1 B')
elif x == 71:
	print('2 A')
elif x == 72:
	print('1 A')
elif x == 73:
	print('0 A')
elif x == 74:
	print('1 B')
elif x == 75:
	print('2 A')
elif x == 76:
	print('1 A')
elif x == 77:
	print('0 A')
elif x == 78:
	print('1 B')
elif x == 79:
	print('2 A')
elif x == 80:
	print('1 A')
elif x == 81:
	print('0 A')
elif x == 82:
	print('1 B')
elif x == 83:
	print('2 A')
elif x == 84:
	print('1 A')
elif x == 85:
	print('0 A')
elif x == 86:
	print('1 B')
elif x == 87:
	print('2 A')
elif x == 88:
	print('1 A')
elif x == 89:
	print('0 A')
elif x == 90:
	print('1 B')
elif x == 91:
	print('2 A')
elif x == 92:
	print('1 A')
elif x == 93:
	print('0 A')
elif x == 94:
	print('1 B')
elif x == 95:
	print('2 A')
elif x == 96:
	print('1 A')
elif x == 97:
	print('0 A')
elif x == 98:
	print('1 B')
elif x == 99:
	print('2 A')
elif x == 100:
	print('1 A')


x = int(input())
lst = []
if x % 4 == 0:
	lst.append('D')
elif x % 4 == 1:
	lst.append('A')
elif x % 4 == 2:
	lst.append('C')
elif x % 4 == 3:
	lst.append('B')
n = x + 1
if n % 4 == 0:
	lst.append('D')
elif n % 4 == 1:
	lst.append('A')
elif n % 4 == 2:
	lst.append('C')
elif n % 4 == 3:
	lst.append('B')
z = x + 2
if z % 4 == 0:
	lst.append('D')
elif z % 4 == 1:
	lst.append('A')
elif z % 4 == 2:
	lst.append('C')
elif z % 4 == 3:
	lst.append('B')
y = sorted(lst)
k = lst.index(y[0])
print(k, y[0])


x = int(input())
cat = [0, 3, 1, 2]
maxcat = -1
kk = -1
for j in range(3):
	k = x + j
	if cat[k % 4] > maxcat:
		maxcat = cat[k % 4]
		kk = j
d = {3: 'A', 2: 'B', 1: 'C', 0: 'D'}
print(kk, d[maxcat])


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	a = [n, n + 1, n + 2]
	f = 0
	for num in a:
		if num % 4 == 1:
			f = 1
			print(num - n, 'A')
			break
	if f:
		continue
	for num in a:
		if num % 4 == 3:
			f = 1
			print(num - n, 'B')
			break
	if f:
		continue
	for num in a:
		if num % 4 == 2:
			f = 1
			print(num - n, 'C')
			break
	if f:
		continue
	for num in a:
		if num % 4:
			f = 1
			print(num - n, 'D')
			break
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


HPLevel = int(input())
HPMap = {1: ['A', 3], 3: ['B', 2], 2: ['C', 1], 0: ['D', 0]}
(maxWay, maxCat, maxLevel) = (0, 'D', 0)
for i in [0, 1, 2]:
	remainder = (HPLevel + i) % 4
	if HPMap[remainder][1] >= maxLevel:
		maxLevel = HPMap[remainder][1]
		maxCat = HPMap[remainder][0]
		maxWay = i
print(str(maxWay) + ' ' + str(maxCat))


y = int(input())
if y % 4 == 1:
	print(0, end=' ')
	print('A')
elif y % 4 == 2:
	print(1, end=' ')
	print('B')
elif y % 4 == 3:
	print(2, end=' ')
	print('A')
elif y % 4 == 0:
	print(1, end=' ')
	print('A')


x = int(input())
s = ['D', 'A', 'C', 'B']
g = []
for i in range(0, 3):
	n = (x + i) % 4
	p = [i, s[n]]
	g.append(p)
k = 0
for i in ['A', 'B', 'C', 'D']:
	for j in g:
		if i == j[1]:
			print(j[0], end=' ')
			print(j[1])
			k = 1
			break
	if k == 1:
		break


hp = int(input())
mod_val = hp % 4
enhance_by = {0: 1, 1: 0, 2: 1, 3: 2}
result = enhance_by.get(mod_val)
hp = result + hp
mod_val = hp % 4
category = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
new_category = category.get(mod_val)
print(f'{result} {new_category}')


x = int(input())
if x % 4 == 2:
	print('1 B')
else:
	print((5 - x % 4) % 4, 'A')


x = int(input())
mas = ('D', 'A', 'C', 'B')
k0 = mas[x % 4]
k1 = mas[(x + 1) % 4]
k2 = mas[(x + 2) % 4]
m = min(k0, k1, k2)
if k0 == m:
	print(0, k0)
elif k1 == m:
	print(1, k1)
else:
	print(2, k2)


x = int(input()) % 4
ans = [(1, 'A'), (0, 'A'), (1, 'B'), (2, 'A')]
print(*ans[x])


number = int(input())
max = 0
for i in range(0, 3):
	if (number + i) % 4 == 1:
		max = 4
		ans = i
	elif (number + i) % 4 == 3 and max < 3:
		max = 3
		ans = i
if max == 4:
	r = 'A'
else:
	r = 'B'
print(str(ans), r)


x = int(input())
ans_a = -1
ans_b = ''
v = [x % 4, (x + 1) % 4, (x + 2) % 4]
if 1 in v:
	ans_b = 'A'
	ans_a = v.index(1)
elif 3 in v:
	ans_b = 'B'
	ans_a = v.index(3)
elif 2 in v:
	ans_b = 'C'
	ans_a = v.index(2)
else:
	ans_b = 'D'
	ans_a = v.index(0)
print(ans_a, ans_b)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
d = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
x = ii()
if x % 4 == 0:
	print(1, 'A')
elif x % 4 == 1:
	print(0, 'A')
elif x % 4 == 2:
	print(1, 'B')
else:
	print(2, 'A')


def get_letter(n):
	if n % 4 == 3:
		return 'B'
	if n % 4 == 2:
		return 'C'
	if n % 4 == 1:
		return 'A'
	else:
		return 'D'
n = int(input())
res1 = get_letter(n % 4)
res2 = get_letter((n + 1) % 4)
res3 = get_letter((n + 2) % 4)
mat = [res1, res2, res3]
answer = mat.index(min(mat))
print(answer, mat[answer])


num = int(input())
ans = 0
ans2 = 'A'
if num % 4 == 1:
	ans = 0
	ans2 = 'A'
elif num % 4 == 3:
	ans = 2
	ans2 = 'A'
elif num % 4 == 2:
	ans = 1
	ans2 = 'B'
elif num % 4 == 0:
	ans = 1
	ans2 = 'A'
print(ans, ans2)


N = int(input())
a = ['1 A', '0 A', '1 B', '2 A']
print(a[N % 4])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()
		r = ('E', -1)
		s = 'DACB'
		for i in range(3):
			t = n + i
			u = (s[t % 4], i)
			if r > u:
				r = u
		rr.append(JA(r[::-1], ' '))
	return JA(rr, '\n')
print(main())


def upgrade(n):
	n %= 4
	if n == 1:
		return '0 A'
	elif n == 3:
		return '2 A'
	elif n == 2:
		return '1 B'
	return '1 A'
print(upgrade(int(input())))


x = int(input())

def g(n):
	if n % 4 == 1:
		return 1
	elif n % 4 == 3:
		return 2
	elif n % 4 == 2:
		return 3
	elif n % 4 == 0:
		return 4
m = {1: 'A', 2: 'B', 3: 'C', 4: 'D'}
ans = min(g(x), g(x + 1), g(x + 2))
if ans == g(x):
	print(0, end=' ')
elif ans == g(x + 1):
	print(1, end=' ')
else:
	print(2, end=' ')
print(m[ans])


n = int(input())
nu = n
res = []
re = []
ret = []
di = {1: 'A', 3: 'B', 2: 'C', 0: 'D'}
for i in range(3):
	res.append(ord(di[(n + i) % 4]))
	ret.append(di[(n + i) % 4])
	re.append(n + i)
ind = ret.index(chr(min(res)))
print(re[ind] - nu, chr(min(res)))


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(1):
	n = int(input())
	print(['1 A', '0 A', '1 B', '2 A'][n % 4])


x = int(input())
a = ['D', 'A', 'C', 'B']
start = a[x % 4]
if start == 'A':
	print('0 A')
elif start == 'B':
	print('2 A')
elif start == 'C':
	print('1 B')
else:
	print('1 A')


import sys

def getCategory(rem):
	if rem == 1:
		return 3
	elif rem == 3:
		return 2
	elif rem == 2:
		return 1
	else:
		return 0

def mapping(cat_0):
	arr = ['D', 'C', 'B', 'A']
	return arr[cat_0]

def runLogic(input):
	num = int(input)
	rem = num % 4
	rem_0 = rem
	rem_1 = (rem + 1) % 4
	rem_2 = (rem + 2) % 4
	cat_0 = getCategory(rem_0)
	cat_1 = getCategory(rem_1)
	cat_2 = getCategory(rem_2)
	highest = max(cat_0, cat_1, cat_2)
	if highest == cat_0:
		return '0 %s' % mapping(cat_0)
	elif highest == cat_1:
		return '1 %s' % mapping(cat_1)
	else:
		return '2 %s' % mapping(cat_2)
for line in sys.stdin:
	input = line
	break
print(runLogic(input))


def f():
	n = int(input())
	lst = [n % 4, (n + 1) % 4, (n + 2) % 4]
	arr = ['D', 'A', 'C', 'B']
	for i in [1, 3, 2, 0]:
		if lst.__contains__(i):
			print(lst.index(i), arr[i])
			break
f()


n = int(input())
m = 0
s = str()
for i in range(3):
	if (n + i) % 4 == 1:
		m = i
		s = str()
		s += 'A'
		break
	elif (n + i) % 4 == 3:
		m = i
		s = str()
		s += 'B'
print(m, s)


n = int(input())
for i in range(3):
	rem = (n + i) % 4
	if rem == 1:
		st = 'A'
		k = i
		break
	elif rem == 3:
		st = 'B'
		k = i
	else:
		pass
print(k, st)


def solve():
	n = int(input())
	m = n % 4
	if m == 1:
		print('0 A')
	elif m == 2:
		print('1 B')
	elif m == 3:
		print('2 A')
	else:
		print('1 A')
solve()


x = int(input())
p = x % 4
if p == 0:
	print(str(1) + ' A')
elif p == 1:
	print(str(0) + ' A')
elif p == 2:
	print(str(1) + ' B')
elif p == 3:
	print(str(2) + ' A')


input = int(input())
A = 'A'
B = 'B'
C = 'C'
reminder = input % 4
if reminder == 1:
	print(0, A)
elif reminder == 3:
	print(2, A)
elif reminder == 2:
	print(1, B)
elif reminder == 0:
	print(1, A)


n = int(input())
cats = {1: 1, 3: 2, 2: 3, 0: 4}
res_cat = cats[n % 4]
ans = res_cat
i = 1
i_ans = 0
while i != 3:
	res_cat = cats[(n + i) % 4]
	if ans > res_cat:
		ans = res_cat
		i_ans = i
	i += 1
print(i_ans, chr(ans + 64))


x = int(input())
level = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
coolness = ['D', 'C', 'B', 'A']
max_cool = coolness.index(level[x % 4])
cur_level = level[x % 4]
dif = 0
for i in range(3):
	res = (x + i) % 4
	if coolness.index(level[res]) > max_cool:
		max_cool = coolness.index(level[res])
		cur_level = level[res]
		dif = i
print(dif, cur_level)


n = int(input())
dict1 = {1: 100, 3: 99, 2: 98, 0: 97}
dict2 = {100: 'A', 99: 'B', 98: 'C', 97: 'D'}
rem = n % 4
a = dict1[rem]
cnt = 0
rem = (n + 1) % 4
if dict1[rem] > a:
	a = dict1[rem]
	cnt = 1
rem = (n + 2) % 4
if dict1[rem] > a:
	a = dict1[rem]
	cnt = 2
print(cnt, end=' ')
print(dict2[a])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	if n % 4 == 1:
		print(0, 'A')
	elif n % 4 == 0:
		print(1, 'A')
	elif n % 4 == 2:
		print(1, 'B')
	elif n % 4 == 3:
		print(2, 'A')
main()


n = int(input())
l = ['D', 'A', 'C', 'B']
x = n % 4
s = 0
if x % 2 == 0:
	x += 1
	s = 1
elif x == 3:
	x += 2
	x = x % 4
	s = 2
print(s, l[x])


tokitsukaze = {}
tokitsukazeHP = int(input())
for i in range(0, 3):
	tokitsukazeCategory = int(tokitsukazeHP + i) % 4
	if tokitsukazeCategory == 0:
		tokitsukaze[i] = 'D'
	elif tokitsukazeCategory == 1:
		tokitsukaze[i] = 'A'
	elif tokitsukazeCategory == 2:
		tokitsukaze[i] = 'C'
	else:
		tokitsukaze[i] = 'B'
sorted_tokitsukaze = sorted(tokitsukaze.items(), key=lambda x: x[1])
(tokitsukaze_added, tokitsukaze_rank) = sorted_tokitsukaze[0]
print(tokitsukaze_added, tokitsukaze_rank)


n = int(input())
s = n % 4
if s == 0:
	ans = '1 A'
elif s == 1:
	ans = '0 A'
elif s == 2:
	ans = '1 B'
elif s == 3:
	ans = '2 A'
print(ans)


num = int(input())
if num % 4 == 1:
	temp = 'A'
	var = 0
if num % 4 == 3:
	var = 2
	temp = 'A'
if num % 4 == 2:
	temp = 'B'
	var = 1
if num % 4 == 0:
	var = 1
	temp = 'A'
print(var, temp)


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j

	def matrixin2(self, m, t=int):
		L = []
		for i in range(m):
			iny = self.cin(str)
			lsmall = []
			for el in iny:
				lsmall.append(t(el))
			L.append(lsmall)
		return L
c = cinn()
x = c.cin()
A = 'A'
B = 'B'
if x % 4 == 1:
	print(0, A)
elif x % 4 == 3:
	print(2, A)
elif x % 4 == 2:
	print(1, B)
else:
	print(1, A)


def tok(n):
	a = 0
	b = ''
	rem = n % 4
	if rem == 1:
		b = 'A'
	elif rem == 0:
		a = 1
		b = 'A'
	elif rem == 2:
		a = 1
		b = 'B'
	elif rem == 3:
		a = 2
		b = 'A'
	return '{:d} {}'.format(a, b)
num = int(input().strip())
print(tok(num))


x = int(input())
a = 0
y = x % 4
A = 1
B = 3
C = 2
D = 0
if y == A:
	print(a, 'A')
elif y == B:
	a = 2
	print(a, 'A')
elif y == C:
	a = 1
	print(a, 'B')
else:
	a = 1
	print(a, 'A')


n = int(input())
lis = []
for i in [0, 1, 2]:
	nn = n + i
	if nn % 4 == 0:
		lis.append((i, 'D'))
	if nn % 4 == 1:
		lis.append((i, 'A'))
	if nn % 4 == 2:
		lis.append((i, 'C'))
	if nn % 4 == 3:
		lis.append((i, 'B'))
lis.sort(key=lambda x: x[1])
print(lis[0][0], end=' ')
print(lis[0][1])


from fractions import gcd
import math

def inverse(a):
	return pow(a, mod - 2, mod)

def usearch(x, a):
	lft = 0
	rgt = len(a) + 1
	while rgt - lft > 1:
		mid = (rgt + lft) // 2
		if a[mid] <= x:
			lft = mid
		else:
			rgt = mid
	return lft

def main():
	n = int(input())
	ans = []
	for i in range(3):
		tmp = (n + i) % 4
		if tmp == 0:
			ans.append(('D', i))
		if tmp == 1:
			ans.append(('A', i))
		if tmp == 2:
			ans.append(('C', i))
		if tmp == 3:
			ans.append(('B', i))
	ans.sort()
	print(ans[0][1], ans[0][0])
main()


current = int(input())

def get_category(x):
	if x % 4 == 1:
		return 'A'
	elif x % 4 == 3:
		return 'B'
	elif x % 4 == 2:
		return 'C'
	elif x % 4 == 0:
		return 'D'
dummy = current
for i in range(3):
	if get_category(current + i) < get_category(dummy):
		dummy = current + i
print(dummy - current, get_category(dummy))


n = int(input())
dict = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
dict1 = {'A': 1, 'C': 2, 'B': 3, 'D': 0}
n = n % 4
m = n
x = []
x.append(dict[(n + 0) % 4])
x.append(dict[(n + 1) % 4])
x.append(dict[(n + 2) % 4])
if 'A' in x:
	y = 'A'
elif 'B' in x:
	y = 'B'
elif 'C' in x:
	y = 'C'
else:
	y = 'D'
print(abs(dict1[y] - m), y)


import sys
try:
	sys.stdin = open('inp.txt', 'r')
except:
	pass

def helper():
	pass
n = int(input())
a = 4 * n + 1
b = 4 * n + 3
c = 4 * n + 2
d = 4 * n
if n % 4 == 1:
	print(0, 'A')
elif n % 4 == 0:
	print(1, 'A')
elif n % 4 == 2:
	print(1, 'B')
elif n % 4 == 3:
	print(2, 'A')


a = int(input())
if a % 4 != 2:
	print(str((1 - a % 4) % 4) + ' A')
else:
	print('1 B')


current_hp = int(input(' '))
if current_hp % 4 == 1:
	cur_cat = 'A'
elif current_hp % 4 == 3:
	cur_cat = 'B'
elif current_hp % 4 == 2:
	cur_cat = 'C'
elif current_hp % 4 == 0:
	cur_cat = 'D'
if cur_cat == 'A':
	print('0 A')
elif cur_cat == 'B':
	print('2 A')
elif cur_cat == 'C':
	print('1 B')
elif cur_cat == 'D':
	print('1 A')


dict1 = {1: '0 A', 3: '2 A', 2: '1 B', 0: '1 A'}
print(dict1[int(input()) % 4])


from collections import Counter
n = int(input())
d = ['A', 'C', 'B', 'D']
r = n % 4
k1 = r
k2 = (r + 1) % 4
k3 = (r + 2) % 4
s = [k1, k2, k3]
f = 1
if 1 in s:
	ans = 0
	for i in range(0, 3):
		if (r + i) % 4 == 1:
			print(i, 'A')
			f = 0
			break
if 3 in s and f == 1:
	ans = 0
	for i in range(0, 3):
		if (r + i) % 4 == 3:
			print(i, 'B')
			break


def solve(test):
	n = int(input())
	if n % 4 == 0:
		print('1 A')
	elif n % 4 == 1:
		print('0 A')
	elif n % 4 == 2:
		print('1 B')
	else:
		print('2 A')
t = 1
for _ in range(t):
	solve(_ + 1)


def fun():
	m = int(input())
	s = [0, 0, 0]
	for i in range(0, 3):
		s[i] = (m + i) % 4
	for i in range(0, 3):
		if s[i] == 1:
			print(i, 'A')
			return 0
	for i in range(0, 3):
		if s[i] == 3:
			print(i, 'B')
			return 0
	for i in range(0, 3):
		if s[i] == 2:
			print(i, 'C')
			return 0
fun()


n = int(input())
t = n
count = 1
ar = ['D', 'A', 'C', 'B']
if n % 4 == 3:
	n += 2
elif n % 4 == 0 or n % 4 == 2:
	n += 1
else:
	n = n
print(n - t, ar[n % 4])


from sys import stdin
n = int(stdin.readline().strip())
n1 = n + 1
n2 = n + 2
arr = ['D', 'A', 'C', 'B']
arr2 = ['A', 'B', 'C', 'D']
n = arr[n % 4]
n1 = arr[n1 % 4]
n2 = arr[n2 % 4]
for i in range(4):
	if n == arr2[i]:
		print(0, n)
		break
	elif n1 == arr2[i]:
		print(1, n1)
		break
	elif n2 == arr2[i]:
		print(2, n2)
		break


a = int(input())
print(abs(a % 4 - 1), ['A', 'B'][a % 4 == 2] if a % 4 else 'A')


from sys import stdin, stdout
N = int(input())
res = 0
res_cat = 0
for i in range(3):
	if (N + i) % 4 == 1:
		ans = 4
	elif (N + i) % 4 == 3:
		ans = 3
	elif (N + i) % 4 == 2:
		ans = 2
	elif (N + i) % 4 == 0:
		ans = 1
	if ans > res:
		res_cat = i
		res = ans
if (N + res_cat) % 4 == 1:
	print(res_cat, 'A')
elif (N + res_cat) % 4 == 3:
	print(res_cat, 'B')
elif (N + res_cat) % 4 == 2:
	print(res_cat, 'C')
elif (N + res_cat) % 4 == 0:
	print(res_cat, 'D')


def main():
	a = int(input())
	reminder = a % 4
	if reminder == 1:
		print('0 A')
	elif reminder == 2:
		print('1 B')
	elif reminder == 3:
		print('2 A')
	else:
		print('1 A')
main()


def det(x):
	if x % 4 == 0:
		return [1, 'D']
	elif x % 4 == 1:
		return [4, 'A']
	elif x % 4 == 2:
		return [2, 'C']
	else:
		return [3, 'B']
hp = int(input())
a = det(hp)
b = det(hp + 1)
c = det(hp + 2)
if a[0] > b[0] and a[0] > c[0]:
	print('0 ' + a[1])
elif b[0] > c[0] and b[0] > a[0]:
	print('1 ' + b[1])
else:
	print('2 ' + c[1])


n = int(input())
level = {0: 3, 2: 2, 3: 1, 1: 0}

def catname(n):
	return chr(level[n] + ord('A'))
inc = 0
best = n % 4
for i in range(2 + 1):
	new_cat = (n + i) % 4
	if level[new_cat] < level[best]:
		inc = i
		best = new_cat
print(inc, catname(best))


current_HP = input()
current_HP_mod4 = int(current_HP) % 4
if current_HP_mod4 == 0:
	print('1 A')
elif current_HP_mod4 == 1:
	print('0 A')
elif current_HP_mod4 == 2:
	print('1 B')
else:
	print('2 A')


N = int(input())
am = N % 4
if am == 1:
	print(0, 'A')
elif am == 2:
	print(1, 'B')
elif am == 3:
	print(2, 'A')
else:
	print(1, 'A')


dic = ['D', 'A', 'C', 'B']
num = int(input())
mn = 'E'
ex = -1
for i in range(3):
	if dic[(num + i) % 4] < mn:
		mn = dic[(num + i) % 4]
		ex = i
print(ex, mn)


def main(x):
	if x % 4 == 1:
		return [0, 'A']
	elif (x + 1) % 4 == 1:
		return [1, 'A']
	elif (x + 2) % 4 == 1:
		return [2, 'A']
	elif x % 4 == 3:
		return [0, 'B']
	elif (x + 1) % 4 == 3:
		return [1, 'B']
	elif (x + 2) % 4 == 3:
		return [2, 'B']
	elif x % 4 == 2:
		return [0, 'C']
	elif (x + 1) % 4 == 2:
		return [1, 'C']
	elif (x + 2) % 4 == 2:
		return [2, 'C']
	elif x % 4 == 0:
		return [0, 'D']
	elif (x + 1) % 4 == 0:
		return [1, 'D']
	elif (x + 2) % 4 == 0:
		return [2, 'D']
x = int(input())
res = main(x)
print(*res)


def hp(x):
	i = 0
	smol = 'Z'
	while i < 3:
		val = x + i
		if val % 4 == 1:
			cur = 'A'
		elif val % 4 == 3:
			cur = 'B'
		elif val % 4 == 2:
			cur = 'C'
		elif val % 4 == 0:
			cur = 'D'
		if cur < smol:
			smol = cur
			ans = [i, cur]
		i += 1
	print(ans.pop(0), ans.pop(0))
x = int(input())
hp(x)


x = int(input())
rem = x % 4
r = ''
x = 0
if rem == 0:
	x += 1
	r = 'A'
elif rem == 1:
	x = 0
	r = 'A'
elif rem == 2:
	x += 1
	r = 'B'
elif rem == 3:
	x += 2
	r = 'A'
print(x, r)


n = int(input())
if n % 4 is 1:
	print(0, 'A', sep=' ')
elif (n + 1) % 4 is 1:
	print(1, 'A', sep=' ')
elif (n + 2) % 4 is 1:
	print(2, 'A', sep=' ')
elif (n + 1) % 4 is 3:
	print(1, 'B', sep=' ')
elif (n + 2) % 4 is 3:
	print(2, 'B', sep=' ')
else:
	print((1, 'C') if (n + 1) % 4 else (2, 'C'))


categs = [0, 2, 3, 1]
n = int(input().strip())
best = n % 4
ans = 0
for i in range(1, 3):
	curr = (n + i) % 4
	if categs.index(curr) > categs.index(best):
		best = curr
		ans = i
s = 'DCBA'
print(ans, s[categs.index(best)])


from sys import stdin
mayor = {0: 'A', 1: 'B', 2: 'C', 3: 'D'}

def div(n):
	if n % 4 == 1:
		return 0
	if n % 4 == 3:
		return 1
	if n % 4 == 2:
		return 2
	if n % 4 == 0:
		return 3
n = int(stdin.readline())
ma = min(div(n), div(n + 1), div(n + 2))
if ma == div(n):
	print(0, mayor[ma])
elif ma == div(n + 1):
	print(1, mayor[ma])
elif ma == div(n + 2):
	print(2, mayor[ma])


num = int(input())
f = {'0': 'D', '1': 'A', '2': 'C', '3': 'B'}
f1 = {'A': 1, 'B': 3, 'C': 2, 'D': 0}
print(abs(num % 4 - f1[sorted([f[str(num % 4)], f[str((num + 1) % 4)], f[str((num + 2) % 4)]])[0]]), sorted([f[str(num % 4)], f[str((num + 1) % 4)], f[str((num + 2) % 4)]])[0])


x = int(input())
d = {1: 'A', 2: 'C', 3: 'B', 0: 'D'}
c = [d[i % 4] for i in range(x, x + 3)]
print(c.index(min(c)), min(c))


import sys
from collections import defaultdict as dc
input = sys.stdin.readline
from bisect import bisect_left, bisect_right
n = int(input())
x = {1: '0 A', 2: '1 B', 3: '2 A', 0: '1 A'}
print(x[n % 4])


def __starting_point():
	n = int(input())
	if n % 4 == 1:
		print('0 A')
	elif n % 4 == 2:
		print('1 B')
	elif n % 4 == 3:
		print('2 A')
	else:
		print('1 A')
__starting_point()


x = int(input())
f = lambda x: 'DACB'[x % 4]
res = [0, f(x)]
for i in range(3):
	if f(x + i) < res[1]:
		res = [i, f(x + i)]
print(*res)


n = int(input())
c1 = n + 0
c2 = n + 1
c3 = n + 2
p1 = str(c1 % 4)
p2 = str(c2 % 4)
p3 = str(c3 % 4)
arr = p1 + p2 + p3
if arr.find('1') != -1:
	print(arr.find('1'), 'A')
elif arr.find('3') != -1:
	print(arr.find('3'), 'B')
elif arr.find('2') != -1:
	print(arr.find('2'), 'C')


from sys import stdin, stdout

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)
categories = {1: ('A', 0), 3: ('A', 2), 2: ('B', 1), 0: ('A', 1)}

def main():
	n = rsingle_int()
	(category, step) = categories[n % 4]
	print('{} {}'.format(step, category))
main()