/* 
   Copyright 2013 Jakub "Cubix651" Cisło
   Interval tree (interval - interval): (+, max)
   Add value for interval and ask about maximum value of interval
   Complexity: O(z log n)
*/

#include <cstdio>
#include <algorithm>
using namespace std;

const int MAX = 131074;
int n, m, z, p, k, l, W[MAX], M[MAX], S;

int greaterPow2(int x)
{
	int res = 1;
	while(res < x)
		res <<= 1;
	return res;
}

void insert(int a, int b, int c)
{
	a += S;
	b += S;
	
	W[a] += c;
	M[a] += c;
	if(a != b)
	{
		W[b] += c;
		M[b] += c;
	}
	
	while(a>>1 != b>>1)
	{
		if(!(a&1))
		{
			W[a+1] += c;
			M[a+1] += c;
		}
		if(b&1)
		{
			W[b-1] += c;
			M[b-1] += c;
		}
		
		a>>=1;
		b>>=1;
		
		M[a] = max(M[a<<1], M[(a<<1)+1]) + W[a];
		M[b] = max(M[b<<1], M[(b<<1)+1]) + W[b];
	}
	while(a != 1)
	{
		a>>=1;
		M[a] = max(M[a<<1], M[(a<<1)+1]) + W[a];
	}
}

int x, y;

int _query(int a, int b, int v, int sum)
{
	if(x <= a && b <= y)
		return sum + M[v];
	if(x > b || y < a)
		return 0;
	return max(
		_query(a, (a+b)/2, 2*v, sum+W[v]),
		_query((a+b)/2 + 1, b, 2*v+1, sum+W[v])
		);
}

int query(int a, int b)
{
	x = a;
	y = b;
	return _query(0, S-1, 1, 0);
}

void printTree()
{
	for(int i = 1; i <= 2*S; ++i)
		printf("(%d %d) ", W[i], M[i]);
	printf("\n\n");
}

/* Example: Task "Rails" (IX OI) */
int main()
{
	scanf("%d%d%d", &n, &m, &z);
	S = greaterPow2(n-1);
	while(z--)
	{
		scanf("%d%d%d", &p, &k, &l);
		--k;
		//printTree();
		if(query(--p, --k) + l <= m)
		{
			insert(p, k, l);
			printf("T\n");
		}
		else
		{
			printf("N\n");
		}
	}
	return 0;
}