#include <bits/stdc++.h>
using namespace std;
string a[550], b[550];
int n, with[550], use[550], need[550], k, offer[550];
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; ++i) cin >> a[i];
  for (register int i = 1; i <= n; ++i) cin >> b[i];
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  for (register int i = 1; i <= n; ++i) {
    ++need[a[i][0]];
    ++offer[b[i][0]];
  }
  k = 1;
  for (register int i = 1; i <= n; ++i) {
    register int j = 1;
    for (; j <= n; ++j) {
      if (use[j] == 0)
        if ((need[b[j][0]] < offer[b[j][0]] || a[i][0] == b[j][0]))
          if (offer[a[i][0]] < need[a[i][0]] || b[j][0] >= a[i][0]) break;
    }
    with[i] = j;
    use[j] = 1;
    --offer[b[j][0]];
    --need[a[i][0]];
  }
  cout << a[1] << " " << b[with[1]];
  for (register int i = 2; i <= n; ++i)
    cout << ", " << a[i] << " " << b[with[i]];
  return 0;
}
