#include <bits/stdc++.h>
using namespace std;
int main() {
  string a[101], b[101], c[101];
  int i, j, n;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++) cin >> b[i];
    sort(a, a + n);
    sort(b, b + n);
    bool mark[101];
    int x[101], y[101];
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    for (i = 0; i < n; i++) {
      x[a[i][0]]++;
      y[b[i][0]]++;
    }
    memset(mark, 0, sizeof(mark));
    for (i = 0; i < n; i++) {
      if (x[a[i][0]] > y[a[i][0]]) {
        for (j = 0; j < n; j++) {
          if (mark[j] == 0 && (y[b[j][0]] > x[b[j][0]] || b[j][0] == a[i][0])) {
            c[i] = b[j];
            mark[j] = 1;
            x[a[i][0]]--;
            y[b[j][0]]--;
            break;
          }
        }
      } else {
        for (j = 0; j < n; j++) {
          if (mark[j] == 0) {
            if (b[j][0] == a[i][0]) {
              c[i] = b[j];
              mark[j] = 1;
              x[a[i][0]]--;
              y[b[j][0]]--;
              break;
            }
          }
        }
        if (j == n) {
          for (j = 0; j < n; j++) {
            if (mark[j] == 0 && y[b[j][0]] > x[b[j][0]]) {
              c[i] = b[j];
              mark[j] = 1;
              x[a[i][0]]--;
              y[b[j][0]]--;
              break;
            }
          }
        }
      }
    }
    cout << a[0] << " " << c[0];
    for (i = 1; i < n; i++) {
      cout << ", " << a[i] << " " << c[i];
    }
    cout << endl;
  }
  return 0;
}
