#include <bits/stdc++.h>
using namespace std;
int N, ca[256], cb[256];
bool use[100];
string A[100], B[100];
int main() {
  int i, j;
  memset(ca, 0, sizeof(ca));
  memset(cb, 0, sizeof(cb));
  cin >> N;
  for (i = 0; i < N; i++) cin >> A[i], ca[A[i][0]]++;
  for (i = 0; i < N; i++) cin >> B[i], cb[B[i][0]]++;
  sort(A, A + N), sort(B, B + N);
  memset(use, false, sizeof(use));
  for (i = 0; i < N; i++) {
    if (i) cout << ", ";
    cout << A[i] << " ";
    for (j = 0; j < N; j++) {
      if (use[j]) continue;
      if ((ca[A[i][0]] > cb[A[i][0]] && ca[B[j][0]] < cb[B[j][0]]) ||
          A[i][0] == B[j][0]) {
        cout << B[j];
        use[j] = true;
        ca[A[i][0]]--, cb[B[j][0]]--;
        break;
      }
    }
  }
  return 0;
}
