#include <bits/stdc++.h>
using namespace std;
string a[500], b[500];
int i, n, j, with[500], use[500], need[500], k, offer[500];
int main() {
  while (cin >> n) {
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (i = 1; i <= n; i++) {
      cin >> b[i];
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (i = 1; i <= n; i++) {
      need[a[i][0]]++;
      offer[b[i][0]]++;
    }
    j = 1;
    k = 1;
    for (i = 1; i <= n; i++) {
      for (j = 1; 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 (i = 2; i <= n; i++) {
      cout << ", " << a[i] << " " << b[with[i]];
    }
  }
  return 0;
}
