#include <bits/stdc++.h>   using namespace std;   int p, numb, hh, i, j, l, n, m, a;   char k;   bool flag;   int h[200000], check[500000], check1[500000], prime[500000], dp[500000];   int main() {     for (i = 2; i <= 100000; i++)       if (check[i] == 0) {         for (j = 2 * i; j <= 100000; j += i) check[j] = 1;       }     for (i = 2; i <= 100000; i++)       if (check[i] == 0) {         l++;         prime[l] = i;       }     cin >> n >> m;     for (i = 1; i <= m; i++) {       cin >> k >> a;       hh = a;       flag = true;       if (k ==  + ) {         if (dp[a] == 1) {           cout <<  Already on  << endl;         } else if (a == 1) {           dp[a] = 1;           cout <<  Success  << endl;         } else {           numb = 0;           hh = a;           for (j = 1; prime[j] * prime[j] <= a; j++)             if (a % prime[j] == 0) {               while (a % prime[j] == 0) a /= prime[j];               if (check1[prime[j]] > 0) {                 cout <<  Conflict with   << check1[prime[j]] << endl;                 flag = false;                 break;               } else {                 numb++;                 h[numb] = prime[j];               }             }           if (flag) {             if (check[a] == 0 && a > 1) {               if (check1[a] > 0) {                 cout <<  Conflict with   << check1[a] << endl;                 flag = false;               } else                 check1[a] = hh;             }             if (flag) {               for (p = 1; p <= numb; p++) check1[h[p]] = hh;               cout <<  Success  << endl;               dp[hh] = 1;             }           }         }       } else {         if (dp[a] == 1) {           hh = a;           cout <<  Success  << endl;           for (j = 1; prime[j] * prime[j] <= a; j++)             if (a % prime[j] == 0) {               while (a % prime[j] == 0) a /= prime[j];               check1[prime[j]] = 0;             }           if (check[a] == 0 && a > 1) check1[a] = 0;           dp[hh] = 0;         } else           cout <<  Already off  << endl;       }     }   }   