#include <bits/stdc++.h>
using namespace std;
string n[102];
string s[102];
int same[102], la[102], lb[102];
bool flag[102];
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> n[i];
  }
  for (int i = 1; i <= t; i++) {
    cin >> s[i];
  }
  sort(n + 1, n + t + 1);
  sort(s + 1, s + t + 1);
  for (int i = 1; i <= t; i++) {
    la[n[i][0]]++;
    lb[s[i][0]]++;
  }
  for (int i = 1; i <= t; i++) {
    int tmp;
    for (int j = 1; j <= t; j++) {
      if (flag[j] == 0 && (la[s[j][0]] < lb[s[j][0]] || n[i][0] == s[j][0]) &&
          (lb[n[i][0]] < la[n[i][0]] || s[j][0] >= n[i][0])) {
        tmp = j;
        break;
      }
    }
    same[i] = tmp;
    flag[tmp] = 1;
    lb[s[tmp][0]]--;
    la[n[i][0]]--;
  }
  for (int i = 1; i <= t; i++) {
    cout << n[i] << " " << s[same[i]];
    if (i != t) cout << ", ";
  }
  return 0;
}
