#include <iostream>
#include <sstream>
using namespace std;
void myPrint(int a, int b, int c, char sep = ' ', char delim = '\n')
{
cout << a << sep << b << sep << c << delim;
if (delim != '\n')
cout << '\n';
}
int main()
{
string line1, line2;
while (getline(cin, line1) && getline(cin, line2))
{
istringstream ss1(line1);
int a, b, c;
ss1 >> a >> b >> c;
istringstream ss2(line2);
int n;
ss2 >> n;
if (n == 0)
{
myPrint(a, b, c);
}
else if (n == 1)
{
char sep;
ss2 >> sep;
myPrint(a, b, c, sep);
}
else if (n == 2)
{
char sep, delim;
ss2 >> sep >> delim;
myPrint(a, b, c, sep, delim);
}
}
return 0;
}