#include <bits/stdc++.h>   using namespace std;   map<string, string> mp;   int main() {     string a, b;     int n, m;     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a >> b;       mp[b] = a;     }     for (int i = 0; i < m; i++) {       cin >> a >> b;       b.pop_back();       cout << a <<     << b <<  ; #  << mp[b] << endl;     }     return 0;   }   