# 202006

## 01 线性分类器

import java.util.Scanner;
public class Main {
public static void main(String[] args)  {
Scanner inScanner = new Scanner(System.in);
int N = inScanner.nextInt();
int M = inScanner.nextInt();

location[] locations = new location[N];
line[] lines = new line[M];

//读取坐标和标记值
for (int i = 0; i < locations.length; i++) {
locations[i] = new location();
locations[i].x = inScanner.nextInt();
locations[i].y = inScanner.nextInt();
locations[i].type = inScanner.next();
}
//读取线段的参数
for (int i = 0; i < lines.length; i++) {
lines[i] = new line();
lines[i].theta0 = inScanner.nextInt();
lines[i].theta1 = inScanner.nextInt();
lines[i].theta2 = inScanner.nextInt();

}

for (int i = 0; i < lines.length; i++) {
long result = lines[i].theta1 * locations[0].x + lines[i].theta2 * locations[0].y + lines[i].theta0;//先读取第一个坐标
String flagString = locations[0].type;//先读取第一个坐标
boolean flag = true;//标记这条直线是否符合要求

//根据与第一个坐标运算的值 相乘， 符号相同，则是同类，否则是异类
for (int j = 1; j < locations.length; j++) { // 从第二行开始，遍历每一个坐标
long temp = lines[i].theta1 * locations[j].x + lines[i].theta2 * locations[j].y + lines[i].theta0;
if(result * temp > 0 && !locations[j].type.equals(flagString)) // 符号相同，应该是同类的，但标记的类型不同，于是这条直线不符合要求
{
flag = false;
break;
}

if(result * temp < 0 && locations[j].type.equals(flagString))// 符号相异，不应该是同类的，但标记的类型相同，于是这条直线不符合要求
{
flag = false;
break;
}
}

if (flag) {
System.out.println("Yes");
}
else {
System.out.println("No");
}

}

}
}

class location{
int x,y;
String type;
}
class line{
int theta0,theta1,theta2;
}



08-21 159
05-31 41
01-28 2万+
07-21 1909
11-17 193
11-18
12-10 326
07-28
01-21 4033