#K15721. Find Influential Users

    ID: 24420 Type: Default 1000ms 256MiB

Find Influential Users

Find Influential Users

You are given a social network with n users and a list of follow relationships between these users. A follow relationship is represented as a directed edge from user u to user v, meaning that user u follows user v.

An influential user is one who is followed by at least k other users. Your task is to identify all influential users and print them in ascending order. If there are no influential users, output No influential users.

The problem can be formalized using the following mathematical condition: A user v is influential if and only if

followers(v)k,\text{followers}(v) \ge k,

where followers(v) denotes the number of users following v.

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. The first line contains two space-separated integers n and k, where n is the number of users and k is the minimum number of followers required for a user to be considered influential.
  2. The second line contains a single integer m, which represents the number of follow relationships.
  3. The next m lines each contain a pair of integers u and v separated by a space, indicating that user u follows user v.

outputFormat

If there exists at least one influential user, print a single line containing all such user IDs in ascending order, separated by a single space. Otherwise, print No influential users.

## sample
6 2
6
1 2
2 3
3 4
4 2
5 6
6 2
2