You are given a directed graph consisting of n vertices. Each directed edge (or arc) labeled with a single character. Initially, the graph is empty.

You should process m queries with it. Each query is one of three types: 

  * "+ u v c" — add arc from u to v with label c. It's guaranteed that there is no arc (u, v) in the graph at this moment; 
  * "- u v" — erase arc from u to v. It's guaranteed that the graph contains arc (u, v) at this moment; 
  * "? k" — find the sequence of k vertices v_1, v_2, ..., v_k such that there exist both routes v_1 → v_2 → ... → v_k and v_k → v_{k - 1} → ... → v_1 and if you write down characters along both routes you'll get the same string. You can visit the same vertices any number of times. 

Input

The first line contains two integers n and m (2 ≤ n ≤ 2 ⋅ 10^5; 1 ≤ m ≤ 2 ⋅ 10^5) — the number of vertices in the graph and the number of queries.

The next m lines contain queries — one per line. Each query is one of three types: 

  * "+ u v c" (1 ≤ u, v ≤ n; u ≠ v; c is a lowercase Latin letter); 
  * "- u v" (1 ≤ u, v ≤ n; u ≠ v); 
  * "? k" (2 ≤ k ≤ 10^5). 



It's guaranteed that you don't add multiple edges and erase only existing edges. Also, there is at least one query of the third type.

Output

For each query of the third type, print YES if there exist the sequence v_1, v_2, ..., v_k described above, or NO otherwise.

Example

Input


3 11
+ 1 2 a
+ 2 3 b
+ 3 2 a
+ 2 1 b
? 3
? 2
- 2 1
- 3 2
+ 2 1 c
+ 3 2 d
? 5


Output


YES
NO
YES

Note

In the first query of the third type k = 3, we can, for example, choose a sequence [1, 2, 3], since 1 \xrightarrow{a} 2 \xrightarrow{b} 3 and 3 \xrightarrow{a} 2 \xrightarrow{b} 1.

In the second query of the third type k = 2, and we can't find sequence p_1, p_2 such that arcs (p_1, p_2) and (p_2, p_1) have the same characters.

In the third query of the third type, we can, for example, choose a sequence [1, 2, 3, 2, 1], where 1 \xrightarrow{a} 2 \xrightarrow{b} 3 \xrightarrow{d} 2 \xrightarrow{c} 1.
import java.util.*;
import java.io.*;
public class EdE {
	static long[] mods = {1000000007, 998244353, 1000000009};
	static long mod = mods[0];
	public static MyScanner sc;
    public static PrintWriter out;
	public static void main(String[] omkar) throws Exception{
		// TODO Auto-generated method stub
 		sc = new MyScanner();
 		out = new PrintWriter(System.out);
//	 		String input1 = bf.readLine().trim();
//	 		String input2 = bf.readLine().trim();
//			COMPARING INTEGER OBJECTS U DO DOT EQUALS NOT ==
 			int n = sc.nextInt();
 			int m = sc.nextInt();
 			ArrayList<Map<Integer, Character>> graph = new ArrayList<>();
 			for(int j = 0;j<=n;j++){
 				graph.add(new HashMap<>());
 			}
 			Set<Pair> doublediff = new HashSet<>();
 			Set<Pair> doublesame = new HashSet<>();
 			for(int k = 0;k<m;k++){
 				int count = 0;
 				char a = sc.next().charAt(0);
 				if (a == '+'){
 					int v1 = sc.nextInt();
 					int v2 = sc.nextInt();
 					char w = sc.next().charAt(0);
 					graph.get(v1).put(v2, w);
 					
 					if (graph.get(v2).containsKey(v1)){
 						if (graph.get(v2).get(v1) == w){
 							doublesame.add(new Pair(v1, v2));
 							doublediff.add(new Pair(v1, v2));
 						}
 						else{
 							doublediff.add(new Pair(v1, v2));
 						}
 					}
 				}
 				else if (a == '-'){
 					int v1 = sc.nextInt();
 					int v2 = sc.nextInt();
 					char w = graph.get(v1).get(v2);
 					graph.get(v1).remove(v2);
 					if (graph.get(v2).containsKey(v1)){
 						if (graph.get(v2).get(v1) == w){
 							doublesame.remove(new Pair(v1, v2));
 							doublediff.remove(new Pair(v1, v2));
 						}
 						else{
 							doublediff.remove(new Pair(v1, v2));
 						}
 					}
 				}
 				else{
 					int v = sc.nextInt();
 					verdict(v%2 == 1 && !doublediff.isEmpty() || v%2 == 0 && !doublesame.isEmpty());
 						
 				}
 				
 			}
 		
	 		
 		out.close();
 	}
	static class Edge{
		private int v;
		private char w;
		public Edge(int v, char w){
			this.v = v;
			this.w = w;
		}
	}
	static class Pair{
		private int x;
		private int y;
		public Pair(int x, int y){
			this.x = x;
			this.y = y;
		}
		@Override
		public boolean equals(Object o){
			Pair p = (Pair) o;
			return (p.x == x && p.y == y) || (p.x == y && p.y == x);
		}
		@Override
		public int hashCode(){
			return (int)(((long)x*(long)y)%1000000007);
		}
	}
	public static void sort(int[] array){
		ArrayList<Integer> copy = new ArrayList<>();
		for (int i : array)
			copy.add(i);
		Collections.sort(copy);
		for(int i = 0;i<array.length;i++)
			array[i] = copy.get(i);
	}
	static String[] readArrayString(int n){
		String[] array = new String[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.next();
		return array;
	}
	static int[] readArrayInt(int n){
    	int[] array = new int[n];
    	for(int j = 0;j<n;j++)
    		array[j] = sc.nextInt();
    	return array;
    }
	static int[] readArrayInt1(int n){
		int[] array = new int[n+1];
		for(int j = 1;j<=n;j++){
			array[j] = sc.nextInt();
		}
		return array;
	}
	static long[] readArrayLong(int n){
		long[] array = new long[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.nextLong();
		return array;
	}
	static double[] readArrayDouble(int n){
		double[] array = new double[n];
		for(int j =0 ;j<n;j++)
			array[j] = sc.nextDouble();
		return array;
	}
	static int minIndex(int[] array){
		int minValue = Integer.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static int minIndex(long[] array){
		long minValue = Long.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static int minIndex(double[] array){
		double minValue = Double.MAX_VALUE;
		int minIndex = -1;
		for(int j = 0;j<array.length;j++){
			if (array[j] < minValue){
				minValue = array[j];
				minIndex = j;
			}
		}
		return minIndex;
	}
	static long power(long x, long y){
		if (y == 0)
			return 1;
		if (y%2 == 1)
			return (x*power(x, y-1))%mod;
		return power((x*x)%mod, y/2)%mod;
	}
	static void verdict(boolean a){
        out.println(a ? "YES" : "NO");
    }
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } 
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            } 
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        
    }	
}

//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is