Relation Reflexive Check

Relation Reflexive Check

Medium Computer Mathematics Sets, Relations & Functions 26 views
Explanation Complexity

Problem Statement

Given n and a list of pairs (a,b), check if relation is reflexive.

Input Format

n m then m pairs.

Output Format

YES or NO.

Example

3 2
1 1
2 2
NO

Constraints

1

Input / Output Format

Input Format
n m then m pairs.
Output Format
YES or NO.
Constraints
1

Examples

Input:
3 2 1 1 2 2
Output:
NO

Example Solution (Public)

Computer Mathematics
Check whether all (i,i) pairs exist for i=1..n. Use a set of pairs.

Official Solution Code

Check whether all (i,i) pairs exist for i=1..n. Use a set of pairs.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.