#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int q,x,ty,cnt = 0;cin>>q;
	char ch;
	while(q--)
	{
		scanf("%d",&ty);
		if(ty==1)    cnt++;
		else 
		{
			scanf("%d %c",&x,&ch);
			if(x ==1)
			{
				if(cnt % 2!=0)a.insert(a.end(),ch);
				else	a.insert(a.begin(),ch);
			}
			else 
			{
				if(cnt % 2 ==0)a.insert(a.end(),ch);
				else	a.insert(a.begin(),ch);
			}
		}
	}
	if(cnt%2 == 1)	reverse(a.begin(),a.end());
	cout<<a;
	
	return 0;
}