#include <bits/stdc++.h>
using namespace std;
vector<string> a, b;
vector<bool> exA, exB;
vector<int> cntA, cntB;
int main() {
  int n;
  cin >> n;
  exA.resize(n, 1);
  exB.resize(n, 1);
  cntA.resize(300, 0);
  cntB.resize(300, 0);
  string s;
  for (int(i) = 0; (i) < (n); ++(i)) {
    cin >> s;
    a.push_back(s);
    cntA[s[0]]++;
  }
  for (int(i) = 0; (i) < (n); ++(i)) {
    cin >> s;
    b.push_back(s);
    cntB[s[0]]++;
  }
  for (int(i) = 0; (i) < (n); ++(i)) {
    int u;
    string z = "z";
    z[0]++;
    for (int(j) = 0; (j) < (n); ++(j))
      if (exA[j] && a[j] < z) {
        z = a[j];
        u = j;
      }
    char ch = a[u][0];
    int u2;
    z = "z";
    z[0]++;
    if (cntA[ch] <= cntB[ch]) {
      for (int(j) = 0; (j) < (n); ++(j))
        if (exB[j] && b[j][0] == ch && b[j] < z) {
          u2 = j;
          z = b[j];
        }
    } else {
      for (int(j) = 0; (j) < (n); ++(j))
        if (exB[j] && b[j] < z &&
            ((cntA[b[j][0]] < cntB[b[j][0]]) || b[j][0] == ch)) {
          z = b[j];
          u2 = j;
        }
    }
    cntA[a[u][0]]--;
    cntB[b[u2][0]]--;
    exA[u] = exB[u2] = 0;
    cout << a[u] << " " << b[u2];
    if (i != n - 1) cout << ", ";
  }
  return 0;
}
