#include <bits/stdc++.h>
using namespace std;
int n, i, j, k;
int va[111], vb[111], f[111];
bool v[111];
string a[111], b[111];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i], va[a[i][0]]++;
  for (i = 1; i <= n; i++) cin >> b[i], vb[b[i][0]]++;
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++)
      if (!v[j] && (a[i][0] == b[j][0] ||
                    va[a[i][0]] > vb[a[i][0]] && va[b[j][0]] < vb[b[j][0]]))
        break;
    f[i] = j, v[j] = true, va[a[i][0]]--, vb[b[j][0]]--;
  }
  for (i = 1; i < n; i++) cout << a[i] << " " << b[f[i]] << ", ";
  cout << a[n] << " " << b[f[n]];
  return 0;
}
