The first line contains the number of courses n (1≤n≤2000) and the number of overlapping relations m (1≤m≤1000000).
Each of the next n lines contains a course number and the department that course belongs to. Course numbers run from 1 to n and each number appears exactly once. A computer department course is marked c, and a software department course is marked s.
Each of the next m lines contains the numbers of two courses whose content overlaps. The two courses belong to different departments, and the same pair of courses never appears twice.