#include <bits/stdc++.h>
char name1[200][20];
char name2[200][20];
int used[200] = {0};
int ca[250] = {0};
int cb[250] = {0};
int pair[200] = {0xFF};
int main() {
  int n;
  char tmp[20];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%s", name1[i]), ca[name1[i][0]]++;
  for (int i = 0; i < n; i++) scanf("%s", name2[i]), cb[name2[i][0]]++;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (strcmp(name1[i], name1[j]) > 0) {
        memcpy(tmp, name1[i], 10);
        memcpy(name1[i], name1[j], 10);
        memcpy(name1[j], tmp, 10);
      }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (strcmp(name2[i], name2[j]) > 0) {
        memcpy(tmp, name2[i], 10);
        memcpy(name2[i], name2[j], 10);
        memcpy(name2[j], tmp, 10);
      }
  for (int i = 0; i < n; i++) {
    int j = 0;
    for (j = 0; j < n; j++)
      if (used[j] == 0 &&
          (name1[i][0] == name2[j][0] || (ca[name1[i][0]] > cb[name1[i][0]] &&
                                          ca[name2[j][0]] < cb[name2[j][0]])))
        break;
    used[j] = 1;
    pair[i] = j;
    ca[name1[i][0]]--;
    cb[name2[j][0]]--;
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) printf(", ");
    printf("%s %s", name1[i], name2[pair[i]]);
  }
}
