#include <iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
char x, y;
int b[3];
int main()
{
while (2==scanf("%c:=%c", &x, &y))
if (y >= '0' && y <= '9')
b[x - 'a'] = y - '0';
else
b[x - 'a'] = b[y - 'a'];
for (int i = 0; i < 3; i++)
cout << b[i] << " ";
return 0;
}