func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, k, m, n, boys[105], girls[105];     while (cin >> n >> m) {       memset(boys, 0, sizeof(boys));       memset(girls, 0, sizeof(girls));       cin >> k;       while (k--) {         cin >> j;         boys[j] = 1;       }       cin >> k;       while (k--) {         cin >> j;         girls[j] = 1;       }       int sqr = max(n, m);       sqr = sqr * sqr;       for (i = 0; i < sqr; i++) {         j = (i % n);         k = (i % m);         boys[j] = (boys[j] || girls[k]);         girls[k] = (boys[j] || girls[k]);       }       bool possible = true;       for (i = 0; i < n; i++) {         if (boys[i] == 0) possible = false;       }       for (i = 0; i < m; i++) {         if (girls[i] == 0) possible = false;       }       if (possible)         cout <<  Yes n ;       else         cout <<  No n ;     }     return 0;   }   