#include <bits/stdc++.h>
using namespace std;
vector<string> name, surname;
int c1[26], c2[26];
bool v[100];
int main() {
  int n;
  cin >> n;
  name.resize(n);
  for (int i = 0; i < n; ++i) cin >> name[i], ++c1[name[i][0] - 'A'];
  sort(begin(name), end(name));
  surname.resize(n);
  for (int i = 0; i < n; ++i) cin >> surname[i], ++c2[surname[i][0] - 'A'];
  sort(begin(surname), end(surname));
  for (int i = 0; i < n; ++i) {
    int k = name[i][0] - 'A';
    if (c2[k] >= c1[k]) {
      for (int j = 0; j < n; ++j)
        if (!v[j] && surname[j][0] - 'A' == k) {
          cout << name[i] << " " << surname[j];
          v[j] = true, --c2[k];
          break;
        }
    } else {
      for (int ii = 0; ii < 26; ++ii)
        if (ii == k && c2[ii] || c2[ii] > c1[ii]) {
          for (int j = 0; j < n; ++j)
            if (!v[j] && surname[j][0] - 'A' == ii) {
              cout << name[i] << " " << surname[j];
              v[j] = true, --c2[ii];
              break;
            }
          break;
        }
    }
    --c1[k];
    if (i == n - 1)
      cout << endl;
    else
      cout << ", ";
  }
  return 0;
}
