#include <bits/stdc++.h>
using namespace std;
struct STR {
  char s[11], t[11];
};
STR sa[111], sb[111];
int ta[30], tb[30];
int ans[111], boo[111];
bool cmp(STR aa, STR bb) { return strcmp(aa.t, bb.t) < 0; }
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%s", sa[i].s);
      int l = strlen(sa[i].s);
      for (int j = 0; j < l; j++) sa[i].t[j] = sa[i].s[j];
      sa[i].t[l] = '\0';
    }
    for (int i = 1; i <= n; i++) {
      scanf("%s", sb[i].s);
      int l = strlen(sb[i].s);
      for (int j = 0; j < l; j++) sb[i].t[j] = sb[i].s[j];
      sb[i].t[l] = '\0';
    }
    sort(sa + 1, sa + n + 1, cmp);
    sort(sb + 1, sb + n + 1, cmp);
    memset(ta, 0, sizeof(ta));
    memset(tb, 0, sizeof(tb));
    for (int i = 1; i <= n; i++) {
      ta[sa[i].t[0] - 'A']++;
      tb[sb[i].t[0] - 'A']++;
    }
    memset(boo, 0, sizeof(boo));
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; i++) {
      if (ta[sa[i].t[0] - 'A'] > tb[sa[i].t[0] - 'A']) {
        for (int j = 1; j <= n; j++)
          if (!boo[j] && (tb[sb[j].t[0] - 'A'] > ta[sb[j].t[0] - 'A'] ||
                          sa[i].t[0] == sb[j].t[0])) {
            boo[j] = 1;
            ans[i] = j;
            ta[sa[i].t[0] - 'A']--;
            tb[sb[j].t[0] - 'A']--;
            break;
          }
      } else {
        for (int j = 1; j <= n; j++)
          if (!boo[j] && sb[j].t[0] == sa[i].t[0]) {
            boo[j] = 1;
            ta[sa[i].t[0] - 'A']--;
            tb[sa[i].t[0] - 'A']--;
            ans[i] = j;
            break;
          }
      }
    }
    for (int i = 1; i < n; i++) {
      printf("%s %s, ", sa[i].t, sb[ans[i]].t);
    }
    printf("%s %s\n", sa[n].t, sb[ans[n]].s);
  }
  return 0;
}
