#3287. 摄像头

摄像头

说明

食品店里有 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>n 个摄像头,这种摄像头很笨拙,只能拍摄到固定位置。现有一群胆大妄为的松鼠想要抢劫食品店,为了不让摄像头拍下他们犯罪的证据,他们抢劫前的第一件事就是砸毁这些摄像头。

为了便于砸毁摄像头,松鼠歹徒们把所有摄像头和摄像头能监视到的地方统一编号,一个摄像头能被砸毁的条件是该摄像头所在位置不被其他摄像头监视。

现在你的任务是帮松鼠们计算是否可以砸掉所有摄像头,如不能则输出还没砸掉的摄像头的数量。

输入格式

输出格式

若可以砸掉所有摄像头则输出“ <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext mathvariant="monospace">YES</mtext></mrow></semantics></math>YES ”,否则输出还没砸掉的摄像头的数量。(不带引号)

样例

5
1 1 2
2 1 1
3 1 7
4 1 1
5 0
2

提示

样例中,摄像头 1 和摄像头 2 是砸不掉的,因为它们可以互相监视。

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100</mn></mrow></semantics></math>1n100

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100</mn></mrow></semantics></math>0m100

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><mi>�</mi><mo separator="true">,</mo><mi>�</mi><mo>≤</mo><mn>500</mn></mrow></semantics></math>0x,y500