func_code_string: #include <bits/stdc++.h>   using namespace std;   void Fast_IO() {     ios::sync_with_stdio(0);     cin.tie(0);   }   long long gcd(long long a, long long b) {     if (a == 0) return b;     return gcd(b % a, a);   }   long long lcm(long long a, long long b) {     if (a == 0 || b == 0) return 0;     return ((a / gcd(a, b)) * b);   }   int main() {     Fast_IO();     long long n, m;     cin >> n >> m;     string s[n], t[m];     for (long long i = (long long)0; i <= (long long)n - 1; i++) cin >> s[i];     for (long long i = (long long)0; i <= (long long)m - 1; i++) cin >> t[i];     long long q;     cin >> q;     while (q--) {       long long y;       cin >> y;       y %= lcm(n, m);       y += lcm(n, m);       long long ni = 0, mi = 0;       for (long long i = (long long)2; i <= (long long)y; i++) {         ni++;         mi++;         ni %= n;         mi %= m;       }       cout << s[ni] + t[mi] <<   n ;     }     return 0;   }   