description: Polycarp has come up with a new game to play with you. He calls it "A missing bigram".
  
  A bigram of a word is a sequence of two adjacent letters in it.
  
  For example, word "abbaaba" contains bigrams "ab", "bb", "ba", "aa", "ab" and "ba".
  
  The game goes as follows. First, Polycarp comes up with a word, consisting only of lowercase letters 'a' and 'b'. Then, he writes down all its bigrams on a whiteboard in the same order as they appear in the word. After that, he wipes one of them off the whiteboard.
  
  Finally, Polycarp invites you to guess what the word that he has come up with was.
  
  Your goal is to find any word such that it's possible to write down all its bigrams and remove one of them, so that the resulting sequence of bigrams is the same as the one Polycarp ended up with.
  
  The tests are generated in such a way that the answer exists. If there are multiple answers, you can print any of them.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 2000) — the number of testcases.
  
  The first line of each testcase contains a single integer n (3 ≤ n ≤ 100) — the length of the word Polycarp has come up with.
  
  The second line of each testcase contains n-2 bigrams of that word, separated by a single space. Each bigram consists of two letters, each of them is either 'a' or 'b'.
  
  Additional constraint on the input: there exists at least one string such that it is possible to write down all its bigrams, except one, so that the resulting sequence is the same as the sequence in the input. In other words, the answer exists.
  
  Output
  
  For each testcase print a word, consisting of n letters, each of them should be either 'a' or 'b'. It should be possible to write down all its bigrams and remove one of them, so that the resulting sequence of bigrams is the same as the one Polycarp ended up with.
  
  The tests are generated in such a way that the answer exists. If there are multiple answers, you can print any of them. 
  
  Example
  
  Input
  
  
  4
  7
  ab bb ba aa ba
  7
  ab ba aa ab ba
  3
  aa
  5
  bb ab bb
  
  
  Output
  
  
  abbaaba
  abaabaa
  baa
  bbabb
  
  Note
  
  The first two testcases from the example are produced from the word "abbaaba". As listed in the statement, it contains bigrams "ab", "bb", "ba", "aa", "ab" and "ba".
  
  In the first testcase, the 5-th bigram is removed. 
  
  In the second testcase, the 2-nd bigram is removed. However, that sequence could also have been produced from the word "abaabaa". It contains bigrams "ab", "ba", "aa", "ab", "ba" and "aa". The missing bigram is the 6-th one.
  
  In the third testcase, all of "baa", "aab" and "aaa" are valid answers.
solution: import java.io.*;
  import java.math.BigInteger;
  import java.util.*;
  import java.util.concurrent.ThreadLocalRandom;
  
  public class Main extends Utils{
      public static void main(String[] args) {
          int t = readInt();
          while (t-- > 0) {
              int n = readInt();
              String[] a = new String[n - 2];
              for (int i = 0; i < n - 2; i++)
                  a[i] = readString();
  
              print("" + a[0].charAt(0) + a[0].charAt(1));
              boolean ch = true;
              for (int i = 1; i < n - 2; i++) {
                  if (a[i - 1].charAt(1) != a[i].charAt(0)) {
                      print("" + a[i].charAt(0));
                      ch = false;
                  }
                  print("" +a[i].charAt(1));
              }
  
              if (ch) {
                  print("" + a[n - 3].charAt(1));
              }
              println();
          }
  
          flush();
      }
  }
  
  class Tuple {
      int _1;
      int _2;
  
      Tuple(int _1, int _2) {
          this._1 = _1;
          this._2 = _2;
      }
  }
  
  class DSU {
      int[] p;
  
      DSU(int size) {
          p = new int[size];
          Arrays.fill(p, -1);
      }
  
      int root(int u) {
          if (p[u] < 0) return u;
          return p[u] = root(p[u]);
      }
  
      void join(int u, int v) {
          int x = root(u);
          int y = root(v);
          if (x == y) return;
  
          if (p[y] < p[x]) {
              int t = x; x = y; y = t;
          }
          p[x] += p[y];
          p[y] = x;
      }
  }
  
  class ST {
      int[] lazy;
      int[][] f;
  
      ST(int n) {
          int size = 4 * Integer.highestOneBit(n);
          f = new int[size][4];
          lazy = new int[size];
      }
  
      /*private void down(int id) {
          if (lazy[id] == Integer.MAX_VALUE) return;
          f[(id << 1) + 1] = lazy[id];
          f[(id << 1) + 2] = lazy[id];
  
          lazy[(id << 1) + 1] = lazy[id];
          lazy[(id << 1) + 2] = lazy[id];
  
          lazy[id] = Integer.MAX_VALUE;
      }*/
  
      /*HashSet[] merge(HashSet<Integer> x, HashSet<Integer> y) {
          int[] rs = new int[(x.length) + y.length];
          int i = 0, j = 0, idx = 0;
          while (i < x.length && j < y.length) {
              if (x[i] < y[j])
                  rs[idx++] = x[i++];
              else
                  rs[idx++] = y[j++];
          }
  
          while (i < x.length)
              rs[idx++] = x[i++];
          while (j < y.length)
              rs[idx++] = y[j++];
          return rs;
      }*/
  
      void build(int id, int l, int r, int[] value) {
          if (l == r) {
               {
                  f[id][0] = value[l];
                  f[id][1] = value[l];
                  f[id][2] = value[l];
              }
              f[id][3] = value[l];
              return;
          }
          int mid = (l + r) >> 1;
          build((id << 1) + 1, l, mid, value);
          build((id << 1) + 2, mid + 1, r, value);
          int[] rs1 = f[(id << 1) + 1];
          int[] rs2 = f[(id << 1) + 2];
          f[id][0] = Math.max(rs1[2] + rs2[1], Math.max(rs1[0], rs2[0]));
          f[id][1] = Math.max(rs1[1], rs1[3] + rs2[1]);
          f[id][2] = Math.max(rs2[2], rs2[3] + rs1[2]);
          f[id][3] = rs1[3] + rs2[3];
      }
  
      /* void update(int id, int l, int r, int u, int v, int value) {
          if (u > r || v < l) return;
          if (u <= l && r <= v) {
              f[id] = value;
              lazy[id] = value;
              return;
          }
          down(id);
          int mid = (l + r) >> 1;
          update((id << 1) + 1, l, mid, u, v, value);
          update((id << 1) + 2, mid + 1, r, u, v, value);
          f[id][0] = Math.max(f[(id << 1) + 1][0], f[(id << 1) + 2][0]);
      }*/
  
      int[] get(int id, int l, int r, int u, int v) {
          if (u > r || v < l) return new int[]{-1000000001, -1000000001, -1000000001, 0};
          if (u <= l && r <= v) return f[id];
          //down(id);
          int mid = (l + r) >> 1;
          int[] rs1 = get((id << 1) + 1, l, mid, u, v);
          int[] rs2 = get((id << 1) + 2, mid + 1, r, u, v);
          int max = Math.max(rs1[2] + rs2[1], Math.max(rs1[0], rs2[0]));
          int left = Math.max(rs1[1], rs1[3] + rs2[1]);
          int right = Math.max(rs2[2], rs2[3] + rs1[2]);
          int all = rs1[3] + rs2[3];
          return new int[]{max, left, right, all};
      }
  }
  
  class BIT {
      int n;
      int[] bit;
  
      BIT(int n) {
          this.n = n;
          bit = new int[n + 1];
      }
  
      void update_dec(int i, int value) {
          for (; i > 0; i -= i & (-i))
              bit[i] += value;
      }
  
      void update_inc(int i, int value) {
          for (; i <= n; i += i & (-i))
              bit[i] += value;
      }
  
      int get_inc(int i) {
          int rs = 0;
          for (; i <= n; i += i & (-i))
              rs += bit[i];
          return rs;
      }
  
      int get_dec(int i) {
          int rs = 0;
          for (; i > 0; i -= i & (-i))
              rs += bit[i];
          return rs;
      }
  
  }
  
  class LCA {
      int[][] rmq;
      long[][] len;
      int[] d;
      int maxH;
  
      LCA (int n, int root, ArrayList<int[]>[] e) {
          maxH = (int)(Math.log(n) / Math.log(2) + 1);
  
          d = new int[n];
          rmq = new int[n][maxH + 1];
          len = new long[n][maxH + 1];
  
          dfs(root, n, e);
      }
  
      long get(int u, int v) {
          if (d[u] < d[v]) {
              int t = u; u = v; v = t;
          }
  
          long slen = 0;
          for (int i = maxH; i >= 0; i--)
              if (d[u] - d[v] >= (1 << i)) {
                  slen += len[u][i];
                  u = rmq[u][i];
              }
  
          if (u == v) return slen;
  
          for (int i = maxH; i >= 0; i--)
              if (rmq[u][i] != rmq[v][i]) {
                  slen += len[u][i] + len[v][i];
                  u = rmq[u][i];
                  v = rmq[v][i];
              }
  
          slen += len[u][0] + len[v][0];
  
          return slen;
      }
  
      int query(int _u, int _v, int k) {
          int u = _u, v = _v;
          if (d[u] < d[v]) {
              int t = u; u = v; v = t;
          }
  
          for (int i = maxH; i >= 0; i--)
              if (d[u] - d[v] >= (1 << i))
                  u = rmq[u][i];
  
          int p = 0;
          if (u == v)
              p = u;
          else {
              for (int i = maxH; i >= 0; i--)
                  if (rmq[u][i] != rmq[v][i]) {
                      u = rmq[u][i];
                      v = rmq[v][i];
                  }
              p = rmq[u][0];
          }
  
          if (d[_u] - d[p] >= k) {
              for (int i = maxH; i >= 0; i--) {
                  if (d[_u] - d[p] >= k && k >= (1 << i)) {
                      _u = rmq[_u][i];
                      k -= 1 << i;
                  }
              }
              return _u;
          } else {
              k -= d[_u] - d[p];
              k = d[_v] - d[p] - k;
              for (int i = maxH; i >= 0; i--) {
                  if (d[_v] - d[p] >= k && k >= (1 << i)) {
                      _v = rmq[_v][i];
                      k -= 1 << i;
                  }
              }
              return _v;
          }
      }
  
      private void dfs(int u, int n, ArrayList<int[]>[] e) {
          for (int[] vw : e[u]) {
              int v = vw[0];
              int w = vw[1];
              if (v != rmq[u][0]) {
                  rmq[v][0] = u;
                  len[v][0] = w;
  
                  for (int i = 1; (1 << i) <= n; i++) {
                      rmq[v][i] = rmq[rmq[v][i - 1]][i - 1];
                      len[v][i] =len[rmq[v][i - 1]][i - 1] + len[v][i - 1];
                  }
                  d[v] = d[u] + 1;
                  dfs(v, n, e);
              }
          }
      }
  }
  
  class HLD {
      int[] idx, parent, link, pos, value;
      ArrayList<ArrayList<Integer>> chain;
      ST[] st;
  
      HLD(int n, int root, ArrayList<int[]>[] e) {
          idx = new int[n];
          parent = new int[n];
          link = new int[n];
          pos = new int[n];
          value = new int[n];
          chain = new ArrayList<>();
  
          dfs(root, e);
  
          for (int u = 0; u < n; u++) {
              if (u == root || link[parent[u]] != u) {
                  chain.add(new ArrayList<>());
                  int curr = chain.size() - 1;
                  for (int v = u; v >=0; v = link[v]) {
                      pos[v] = chain.get(curr).size();
                      chain.get(curr).add(v);
                      idx[v] = curr;
                  }
              }
          }
  
          st = new ST[chain.size()];
          for (int i = 0; i < chain.size(); i++) {
              st[i] = new ST(chain.get(i).size());
  
              int[] mapValue = new int[chain.get(i).size()];
              for (int j = 0; j < mapValue.length; j++)
                  mapValue[j] = value[chain.get(i).get(j)];
  
              st[i].build(0, 0, chain.get(i).size() - 1, mapValue);
          }
      }
  
      private int dfs(int u, ArrayList<int[]>[] e) {
          link[u] = -1;
  
          int maxS = 0, sumS = 1;
          for (int[] vw : e[u]) {
              int v = vw[0], w = vw[1];
              if (v != parent[u]) {
                  parent[v] = u;
                  value[u] = w;
                  int size = dfs(v, e);
                  if (size > maxS) {
                      maxS = size;
                      link[u] = v;
                  }
                  sumS += size;
              }
          }
          return sumS;
      }
  
      /*int get(int u, int v) {
          if (idx[u] != idx[v]) {
              int rs = get(u, parent[chain.get(idx[v]).get(0)]);
              if (rs > 0) return rs;
              return get(chain.get(idx[v]).get(0), v);
  
          }
          return st[idx[u]].get(0, 0, chain.get(idx[u]).size() - 1, pos[u], pos[v]);
      }
  
      void update(int u) {
          value[u] ^= 1;
          st[idx[u]].update(0, 0, chain.get(idx[u]).size() - 1, pos[u], pos[u], value[u] > 0 ? u + 1 : 0);
      }*/
  
     /* int get(int u, int v) {
          int[] rs2 = new int[]{-1000000001, -1000000001, -1000000001, 0};;
          while(idx[u] != idx[v]) {
              if (idx[u] > idx[v]) {
                  int t = u; u = v; v = t;
              }
              int[] rs1 = st[idx[v]].get(0, 0, chain.get(idx[v]).size() - 1, pos[chain.get(idx[v]).get(0)], pos[v]);
              int max = Math.max(rs1[2] + rs2[1], Math.max(rs1[0], rs2[0]));
              int left = Math.max(rs1[1], rs1[3] + rs2[1]);
              int right = Math.max(rs2[2], rs2[3] + rs1[2]);
              int all = rs1[3] + rs2[3];
              rs2 = new int[]{max, left, right, all};
              v = parent[chain.get(idx[u]).get(0)];
          }
          int[] rs1 = st[idx[u]].get(0, 0, chain.get(idx[u]).size() - 1, Math.min(pos[u], pos[v]) + 1, Math.max(pos[u], pos[v]));
          return Math.max(rs1[2] + rs2[1], Math.max(rs1[0], rs2[0]));
      }
  
      void update(int u, int v, int w) {
          while(idx[u] != idx[v]) {
              if (idx[v] < idx[u]) {
                  int t = u; u = v; v = t;
              }
              st[idx[v]].update(0, 0, chain.get(idx[v]).size() - 1, pos[chain.get(idx[v]).get(0)], pos[v], w);
              v = parent[chain.get(idx[u]).get(0)];
          }
          st[idx[u]].update(0, 0, chain.get(idx[u]).size() - 1, Math.min(pos[u], pos[v]), Math.max(pos[u], pos[v]), w);
      }*/
  }
  
  abstract class Utils {
      static PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
      static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      static StringTokenizer st = new StringTokenizer("");
  
      static void print(Object s) {
          writer.print(s);
      }
  
      static void println(Object s) {
          writer.println(s);
      }
  
      static void println() {
          writer.println();
      }
  
      static void flush() {
          writer.close();
      }
  
      static String next() {
          while (!st.hasMoreTokens()) {
              try {
                  st = new StringTokenizer(reader.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
  
      static int readInt() {
          return Integer.parseInt(next());
      }
  
      static long readLong() {
          return Long.parseLong(next());
      }
  
      static char[] readStr() {
          return next().toCharArray();
      }
  
      static String readString() {
          return next();
      }
  
      static char readChar() {
          return next().charAt(0);
      }
  
      static int[] readArrayInt(int n) {
          int[] a = new int[n];
          for(int i = 0; i < n; i++)
              a[i] = readInt();
          return a;
      }
  
      static BigInteger pow(BigInteger a, BigInteger b) {
          if (b.compareTo(BigInteger.valueOf(0)) == 0) return BigInteger.valueOf(1);
          BigInteger rs = pow(a, (b.divide(BigInteger.valueOf(2))));
          return rs.multiply(rs).multiply(b.mod(BigInteger.valueOf(2)).compareTo(BigInteger.ZERO) == 0 ? BigInteger.ONE : a);
      }
  
      static long pow(long a, long b) {
          if (b == 0) return 1;
  
          long rs = pow(a, b / 2);
          return rs * rs * (b % 2 == 0 ? 1 : a);
      }
  
      static long GCD(long a, long b) {
          if (a == 0) return b;
          return GCD(b % a, a);
      }
  
      static long LCM(long a, long b) {
          return (a / GCD(a,b)) * b;
      }
  
      static void shuffle(int[][] a) {
          Random rand = ThreadLocalRandom.current();
          for (int i = a.length - 1; i >= 0; i--) {
              int idx = rand.nextInt(i + 1);
              int[] t = a[idx];
              a[idx] = a[i];
              a[i] = t;
          }
      }
  }
  
  
  