#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100000

int boss[NUM],BASE[NUM],ADD[NUM];

int get_boss(int id){
	if(boss[id] == id)return id;
	else{

		int next_boss = get_boss(boss[id]);

		BASE[id] += BASE[boss[id]];

		return boss[id] =  next_boss;
	}
}

int get_value(int id){
	return BASE[id]+ADD[id]-ADD[boss[id]];
}

void unite(int A,int B,int diff){

	int boss_A = get_boss(A);
	int boss_B = get_boss(B);

	if(boss_A == boss_B)return;

	boss[boss_B] = boss_A;
	BASE[boss_B] += BASE[A]+ADD[A]+diff-(BASE[B]+ADD[B]);
}

int main(){

	int N,Q;
	scanf("%d %d",&N,&Q);

	for(int i = 0; i < N; i++){
		boss[i] = i;
		BASE[i] = 0;
		ADD[i] = 0;
	}

	char buf[8];

	int A,B,diff;

	for(int loop = 0; loop < Q; loop++){
		scanf("%s",buf);

		if(buf[0] == 'I'){

			scanf("%d %d %d",&A,&B,&diff);
			A--;
			B--;

			ADD[A] += diff;
			ADD[B] += diff;

			unite(A,B,diff);

		}else{ //compare
			scanf("%d %d",&A,&B);
			A--;
			B--;

			if(get_boss(A) != get_boss(B)){
				printf("WARNING\n");
				continue;
			}

			printf("%d\n",get_value(B)-get_value(A));
		}
	}

	return 0;
}

