#include int main() { int n; scanf("%d", &n); int i; int t; char c; char ans[500005]; int l, r; l = r = 200005; scanf("%d %c", &t, &c); ans[r] = c; r++; l--; for (i = 1; i < n; i++) { scanf("%d %c", &t, &c); if (t > 0) { ans[l] = c; l--; } else { ans[r] = c; r++; } } for (i = l + 1; i < r; i++) printf("%c", ans[i]); printf("\n"); return 0; }