#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
const double PI = acos((double)-1);
int ts, ts2, ts3, ts4;
int n, m;
long long gcd(long long x, long long y) {
  long long t;
  for (; y != 0;) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
string a[1005], b[1005];
int ap[1005], bp[1005], am[1005], bm[1005];
int main() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  int tt1, tt2, tt3, tt4;
  double u1, u2, u3, u4, u5, u6, u7, u8, u9;
  char c1, c2, c3;
  srand((unsigned)time(0));
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i], ap[a[i][0]]++;
  for (i = 1; i <= n; i++) cin >> b[i], bp[b[i][0]]++;
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++)
      if (bm[j] == 0 &&
          ((ap[a[i][0]] > bp[a[i][0]] && ap[b[j][0]] < bp[b[j][0]]) ||
           a[i][0] == b[j][0])) {
        am[i] = j, bm[j] = i, ap[a[i][0]]--, bp[b[j][0]]--;
        break;
      }
    if (j > n)
      for (;;)
        ;
  }
  for (i = 1; i <= n; i++) {
    if (!am[i]) {
      int* i = 0;
      *i = 1;
    }
    cout << a[i] << " " << b[am[i]];
    if (i < n) cout << ", ";
  }
  cout << endl;
  return 0;
}
