#include <bits/stdc++.h>
struct P {
  char s[200];
} name[200], sumame[200];
bool cmp(const P& p1, const P& p2) {
  for (int i = 0; 1; i++)
    if (p1.s[i] != p2.s[i]) return p1.s[i] < p2.s[i];
}
int n, link[200], need[300], have[300];
bool use[200];
int main() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", name[i].s);
    ++need[name[i].s[0]];
  }
  for (int i = 1; i <= n; i++) {
    scanf("%s", sumame[i].s);
    ++have[(int)sumame[i].s[0]];
  }
  std::sort(name + 1, name + 1 + n, cmp);
  std::sort(sumame + 1, sumame + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    if (have[name[i].s[0]] >= need[name[i].s[0]])
      for (int j = 1; j <= n; j++)
        if (name[i].s[0] == sumame[j].s[0] && !use[j]) {
          link[i] = j;
          use[j] = 1;
          --have[sumame[j].s[0]];
          break;
        }
    if (!link[i])
      for (int j = 1; j <= n; j++)
        if ((name[i].s[0] == sumame[j].s[0] ||
             have[sumame[j].s[0]] > need[sumame[j].s[0]]) &&
            !use[j]) {
          link[i] = j;
          --have[sumame[j].s[0]];
          use[j] = 1;
          break;
        }
    --need[name[i].s[0]];
  }
  for (int i = 1; i <= n; i++) {
    printf("%s %s", name[i].s, sumame[link[i]].s);
    if (i != n) printf(", ");
  }
}
