func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, b, g, x, y;     bool women[100], man[100];     cin >> n >> m;     cin >> b;     for (int i = 0; i < n; i++) man[i] = 0;     for (int i = 0; i < m; i++) women[i] = 0;     for (int i = 0; i < b; i++) {       cin >> x;       man[x] = 1;     }     cin >> g;     for (int i = 0; i < g; i++) {       cin >> y;       women[y] = 1;     }     for (int i = 0; i <= (n * m) * (n * m); i++) {       if (man[i % n] == 1)         women[i % m] = 1;       else {         if (women[i % m] == 1) man[i % n] = 1;       }     }     bool flag1 = 1, flag2 = 1;     for (int i = 0; i < n; i++) flag1 *= man[i];     for (int i = 0; i < m; i++) flag2 *= women[i];     if (flag1 == 1 && flag2 == 1)       cout <<  Yes ;     else       cout <<  No ;   }   