#include <bits/stdc++.h>
using namespace std;
int n;
int a[30], b[30];
bool u[123];
string A[123], B[123];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) cin >> A[i], ++a[A[i][0] - 'A'];
  for (int i = 1; i <= n; ++i) cin >> B[i], ++b[B[i][0] - 'A'];
  sort(A + 1, A + 1 + n);
  sort(B + 1, B + 1 + n);
  for (int i = 1, p, q; i <= n; ++i) {
    p = A[i][0] - 'A';
    if (i > 1) printf(", ");
    cout << A[i] << ' ';
    for (int j = 1; j <= n; ++j)
      if (!u[j]) {
        q = B[j][0] - 'A';
        if (p == q || a[p] > b[p] && a[q] < b[q]) {
          u[j] = 1, --b[q];
          cout << B[j];
          break;
        }
      }
    --a[p];
  }
  puts("");
  return 0;
}
