#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	string s;
	char c;
	int q;
	int t, f;
	int cnt = 0;
	
	cin >> s;
	cin >> q;
	
	for(int i = 1; i <= q; i++)
	{
		cin >> t;
		if(t == 1)
		{
			cnt++;
		}
		if(t == 2)
		{
			cin >> f >> c;
			if(!(cnt % 2))
			{
				if(f == 1)
					s.insert(s.begin(), c);
				if(f == 2)
					s.insert(s.end(), c);
			}
			else
			{
				if(f == 1)
					s.insert(s.end(), c);
				if(f == 2)
					s.insert(s.begin(), c);
			}
		}
	}
	if(cnt % 2)
		reverse(s.begin(), s.end());
	cout << s << endl;
	
	return 0;
}