#include <iostream>
#include <string>
using namespace std;
int judge_done(int arr[8]) {
for (int i = 0; i < 8; i++) {
if (arr[i] != 0) {
return 1;
}
}
return 0;
}
int judge_zero(int arr[3], int arr_all[8]) {
for (int i = 0; i < 3; i++) {
if (arr_all[arr[i]] != 0) {
return 1;
}
}
return 0;
}
int find_same(int arr1[3], int arr2[3]) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (arr1[i] == arr2[j]) {
return arr1[i];
}
}
}
return 0;
}
int main() {
int arr[8];
string arr_name = "ABCDEFGH";
for (int i = 0; i < 8; i++) cin >> arr[i];
if (arr[0] + arr[2] + arr[5] + arr[7] != arr[1] + arr[3] + arr[4] + arr[6]) {
cout << "IMPOSSIBLE" << endl;
}
else {
int neighbor[8][3] = { { 1, 3, 4 } ,{ 0, 2, 5 },{ 1, 3, 6 },{ 0, 2, 7 },{ 0, 5, 7 },{ 1, 4, 6 },{ 2, 5, 7 },{ 3, 4, 6 } };
int max, position, temp_position;
while (judge_done(arr)) {
max = arr[0]; position = 0;
for (int i = 0; i < 8; i++) {
max = max >= arr[i] ? max : arr[i];
position = max > arr[i] ? position : i;
}
if (max > 0) {
if (judge_zero(neighbor[position], arr)) {
for (int i = 0; i < 3; i++) {
if (arr[neighbor[position][i]] != 0) {
arr[position]--;
arr[neighbor[position][i]]--;
cout << arr_name[position] << arr_name[neighbor[position][i]] << "-" << endl;
break;
}
}
}
else {
for (int i = 0; i < 8; i++) {
if (i == position) continue;
else if (arr[i] != 0) {
temp_position = i;
break;
}
}
int position1 = neighbor[position][0];
int position2 = find_same(neighbor[position1], neighbor[temp_position]);
arr[position1]++; arr[position2]++;
cout << arr_name[position1] << arr_name[position2] << "+" << endl;
}
}
}
}
return 0;
}