#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define mpr make_pair
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define ms(a,n) memset(a , n , sizeof(a))
#define FOR(i,a,b) for(int i = a ; i <= b ;i++)
#define RFOR(i,a,b) for(int i = b ; i >= a ; i--)
#define fact_io() ios::sync_with_stdio(NULL);cout.tie(NULL);
#define sz(a) a.size()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll>pl;
typedef vector<ll>vll;
typedef vector<int>vii;
typedef pair<int,int>pi;
const int MOD = 1e9 + 7;

inline ll gcd(ll a , ll b) {return b == 0 ? a : gcd(b , a % b);}
inline ll lcm(ll a , ll b) {return a / gcd(a , b) * b ;}
struct node
{
	int x , y , cnt;
};
int a[15][15];
int dx[] = {1 , 0 , 0};
int dy[] = {0 , 1 , -1};
int BFS(int s , int t, int x , int y)
{
	queue<node>q;
	ms(a , 0);
	q.push({s , t , 0});
	a[s][t] = 1;
	while(!q.empty())
	{
		node tmp = q.front();
		q.pop();
		int i = tmp.x , j = tmp.y , cnt = tmp.cnt;
		if(i == x && j == y)
		{
			return cnt;
		}
		if(i >= 5)
		{
			for(int k = 0 ; k < 3 ; k++)
			{
				int i1 = i + dx[k];
				int j1 = j + dy[k];
				if(i1 < 0 || j1 < 0 || i1 > 9 || j1 > 8 || a[i1][j1] == 1) continue;
				a[i1][j1] = 1;
				q.push({i1 , j1 , cnt + 1});
			}
		}
		else
		{
			q.push({i + 1 , j , cnt + 1});
		}
	}
	return -1;
}
int main()
{
	ios::sync_with_stdio(NULL);cout.tie(NULL);cin.tie(NULL);
	int x , y ; cin >> x>> y;
	int b[6];
	b[1] = BFS(3 , 0 , x , y);
	b[2] = BFS(3 , 2 , x , y);
	b[3] = BFS(3 , 4 , x , y);
	b[4] = BFS(3 , 6 , x , y);
	b[5] = BFS(3 , 8 , x , y);
	int ans = 100;
	char c;
	for(int i = 1 ; i <= 5 ; i++)
	{
		if(b[i] < ans && b[i] != -1)
		{
			ans = b[i];
			c = 'A' + i - 1;
		}
	}
	if(ans == 100) cout << -1;
	else
	{
		cout << ans << endl;
		cout << c;
	}
	return  0;
}