#include <bits/stdc++.h>
using namespace std;
string a[100005], b[100005];
int l[1005], r[1005];
bool vis[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    l[a[i][0]]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    r[b[i][0]]++;
  }
  sort(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (!vis[j] && (a[i][0] == b[j][0] ||
                      (l[a[i][0]] > r[a[i][0]] && r[b[j][0]] > l[b[j][0]]))) {
        l[a[i][0]]--;
        r[b[j][0]]--;
        vis[j] = true;
        if (i) cout << ", ";
        cout << a[i] << " " << b[j];
        break;
      }
    }
  }
  return 0;
}
