// Arup Guha
// 6/16/2023
// CF Div 3 Round 878 Problem A
// https://codeforces.com/contest/1840/problem/A

using namespace std;
#include <bits/stdc++.h>

int main() {

    int nC;
    cin >> nC;

    // Process cases.
    for (int loop=0; loop<nC; loop++) {

        // Read string.
        int sz;
        string s;
        cin >> sz >> s;

        // Loop through...
        string t = "";
        int i=0;
        while (i<s.size()) {

            // ID start and end characters that map to one.
            int sI = i, eI=i+1;
            while (s[eI] != s[sI]) eI++;

            // Add it and continue.
            t += s[sI];
            i = eI+1;
        }

        // Ta da!
        cout << t << endl;
    }

    return 0;
}
