#include <bits/stdc++.h>
using namespace std;
string a[105], b[105];
int ca[105];
int cb[105];
int h[105];
int corr[105];
int n;
void work() {
  int i, j;
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= n; ++j)
      if (h[j] == 0 && (a[i][0] == b[j][0] ||
                        ca[a[i][0]] > cb[a[i][0]] && ca[b[j][0]] < cb[b[j][0]]))
        break;
    corr[i] = j, h[j] = 1;
    --ca[a[i][0]];
    --cb[b[j][0]];
  }
}
int main() {
  int i;
  ios::sync_with_stdio(false);
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    ++ca[a[i][0]];
  }
  for (i = 1; i <= n; ++i) {
    cin >> b[i];
    ++cb[b[i][0]];
  }
  sort(&a[1], &a[n + 1]);
  sort(&b[1], &b[n + 1]);
  work();
  for (i = 1; i < n; ++i) cout << a[i] << " " << b[corr[i]] << ", ";
  cout << a[n] << " " << b[corr[n]] << endl;
  return 0;
}
