#include <bits/stdc++.h>
using namespace std;
int n;
string a[100], b[100];
bool used[100];
int cnt[26] = {}, cntA[26] = {};
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  for (int i = 0; i < (int)(n); ++i) cin >> b[i];
  for (int i = 0; i < (int)(n); ++i) used[i] = false;
  for (int i = 0; i < (int)(n); ++i) --cnt[a[i][0] - 'A'];
  for (int i = 0; i < (int)(n); ++i) ++cnt[b[i][0] - 'A'];
  for (int i = 0; i < (int)(26); ++i) cntA[i] = -cnt[i];
  sort(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < (int)(n); ++i) {
    cout << a[i] << ' ';
    int best = -1;
    for (int j = 0; j < (int)(n); ++j)
      if (!used[j]) {
        if (a[i][0] == b[j][0]) {
          best = j;
          break;
        }
        if (cnt[b[j][0] - 'A'] > 0 && cntA[a[i][0] - 'A'] > 0) {
          best = j;
          --cnt[b[j][0] - 'A'];
          --cntA[a[i][0] - 'A'];
          break;
        }
      }
    assert(best != -1);
    used[best] = true;
    cout << b[best];
    if (i == n - 1)
      cout << endl;
    else
      cout << ", ";
  }
  return 0;
}
