#include <iostream>
#include <cstdlib>
using namespace std;
int main(void)
{
int correct_chess[6] = {1, 1, 2, 2, 2, 8};
int white[6];
int i;
for (i = 0; i < 6; i++)
{
cin >> white[i];
if (white[i] >= 0 && white[i] <= 10)
{
white[i] = correct_chess[i] - white[i];
}
else
{
break;
}
}
for (i = 0; i < 6; i++)
{
cout << white[i] << " ";
}
cout << endl;
return 0;
}