#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,m;
bool open[N];
int s[N],top=1;
int gcd(int a,int b){
if (b==0) return a;
return gcd(b,a%b);
}
int main(){
cin>>n>>m;
for (int j=1;j<=m;j++){
char op;
int x;
cin>>op>>x;
if (op=='-'){
if (open[x]){
open[x]=false;
for (int i=1;i<top;i++){
if (s[i]==x){
s[i]=-1;
break;
}
}
cout<<"Success"<<endl;
}
else cout<<"Already off"<<endl;
}
else{
if (open[x]) cout<<"Already on"<<endl;
else{
bool qwe=true;
int f=0;
for (int i=1;i<top;i++){
if (s[i]==-1) continue;
if (gcd(s[i],x)!=1){
f=s[i];
qwe=false;
break;
}
}
if(qwe){
open[x]=true;
s[top]=x;
top++;
cout<<"Success"<<endl;
}
else cout<<"Conflict with "<<f<<endl;
}
}
}
return 0;
}
求大佬帮忙。