#include <bits/stdc++.h>
using namespace std;
int s1[110], s2[110], pd[110];
int i, j, n;
string a[110], b[110];
int main() {
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) cin >> a[i], s1[a[i][0]]++;
  for (i = 0; i < n; i++) cin >> b[i], s2[b[i][0]]++;
  memset(pd, 0, sizeof(pd));
  sort(a, a + n);
  sort(b, b + n);
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      if (!pd[j] && (a[i][0] == b[j][0] || (s1[a[i][0]] > s2[a[i][0]] &&
                                            s1[b[j][0]] < s2[b[j][0]]))) {
        pd[j] = 1;
        s1[a[i][0]]--;
        s2[b[j][0]]--;
        if (i) cout << ", ";
        cout << a[i] << " " << b[j];
        break;
      }
  cout << endl;
  return 0;
}
