Problem3085--D. 优秀的作品

3085: D. 优秀的作品

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

博爱小学举办书法大赛,学校一共收到了 lns="http://www.w3.org/1998/Math/MathML">N 个同学的作品,并给作品编号 lns="http://www.w3.org/1998/Math/MathML">1 \sim N

这 lns="http://www.w3.org/1998/Math/MathML">N 幅作品被放到了学校的展厅展览,并请全校同学进行公开投票。投票结束,学校收到了 lns="http://www.w3.org/1998/Math/MathML">M 张投票,每张投票投给了 lns="http://www.w3.org/1998/Math/MathML">1 幅参赛的作品;学校预计评比出一等奖、二等奖、三等奖 各 lns="http://www.w3.org/1998/Math/MathML">1 名;

由于可能存在多个优秀作品得票数相同的情况,因此最终实际获奖名额可能会比预计多,这种情况下,学校会增加相应奖项等级的获奖名额。

比如,如果有 lns="http://www.w3.org/1998/Math/MathML">3 位同学得票数并列第 lns="http://www.w3.org/1998/Math/MathML">1,这种情况学校会颁发出 lns="http://www.w3.org/1998/Math/MathML">3 个一等奖。

请编程统计出一等奖、二等奖、三等奖获奖作品的编号。

Input

第 lns="http://www.w3.org/1998/Math/MathML">1 行读入 lns="http://www.w3.org/1998/Math/MathML">2 个整数 lns="http://www.w3.org/1998/Math/MathML">N 和 lns="http://www.w3.org/1998/Math/MathML">M,分别代表参赛作品的数量和投票的数量;

第 lns="http://www.w3.org/1998/Math/MathML">2 行读入 lns="http://www.w3.org/1998/Math/MathML">M 个整数,第 lns="http://www.w3.org/1998/Math/MathML">i 个整数 lns="http://www.w3.org/1998/Math/MathML">A_i 代表了第 lns="http://www.w3.org/1998/Math/MathML">i 张投票投给了编号为 lns="http://www.w3.org/1998/Math/MathML">A_i 的作品。

Output

输出 lns="http://www.w3.org/1998/Math/MathML">3 行,每行输出若干整数,用空格隔开;

第 lns="http://www.w3.org/1998/Math/MathML">1 行输出一等奖获奖作品的编号,第 lns="http://www.w3.org/1998/Math/MathML">2 行输出二等奖获奖作品的编号,第 lns="http://www.w3.org/1998/Math/MathML">3 行输出三等奖获奖作品的编号;

如果某个奖项有多个作品获得,那么该奖项的获奖作品编号按照编号值从小到大的顺序输

Sample Input Copy

8 15
3 3 3 4 4 4 6 6 8 8 7 7 5 1 2

Sample Output Copy

3 4
6 7 8
1 2 5

HINT

样例2输入:
10 16
6 5 7 2 2 1 1 7 4 2 2 7 7 2 4 4 
样例2输出:
2
7
4

样例 lns="http://www.w3.org/1998/Math/MathML">1 解释

lns="http://www.w3.org/1998/Math/MathML">3 号作品和 lns="http://www.w3.org/1998/Math/MathML">4 号作品各获得 lns="http://www.w3.org/1998/Math/MathML">3 票,并列第 lns="http://www.w3.org/1998/Math/MathML">1,评选为一等奖;

lns="http://www.w3.org/1998/Math/MathML">6 号作品、lns="http://www.w3.org/1998/Math/MathML">8 号作品、lns="http://www.w3.org/1998/Math/MathML">7 号作品各获得 lns="http://www.w3.org/1998/Math/MathML">2 票,并列第 lns="http://www.w3.org/1998/Math/MathML">2 ,评选为二等奖;

lns="http://www.w3.org/1998/Math/MathML">5 号作品、lns="http://www.w3.org/1998/Math/MathML">1 号作品、lns="http://www.w3.org/1998/Math/MathML">2 号作品各获得 lns="http://www.w3.org/1998/Math/MathML">1 票,并列第 lns="http://www.w3.org/1998/Math/MathML">3 ,评选为三等奖;

数据范围

对于 lns="http://www.w3.org/1998/Math/MathML">100\% 的数据,lns="http://www.w3.org/1998/Math/MathML">6 \le N,M \le 100000lns="http://www.w3.org/1998/Math/MathML">1 \le A_i \le N

测试数据确保统计后一等奖、二等奖、三等奖至少各有 lns="http://www.w3.org/1998/Math/MathML">1 人。



Source/Category