CF22C.System Administrator

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Bob got a job as a system administrator in X corporation. His first task was to connect nn servers with the help of mm two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of servers should have at most one direct connection. Y corporation, a business rival of X corporation, made Bob an offer that he couldn't refuse: Bob was asked to connect the servers in such a way, that when server with index vv fails, the transmission of data between some other two servers becomes impossible, i.e. the system stops being connected. Help Bob connect the servers.

输入格式

The first input line contains 3 space-separated integer numbers nn , mm , vv ( 3<=n<=105,0<=m<=105,1<=v<=n3<=n<=10^{5},0<=m<=10^{5},1<=v<=n ), nn — amount of servers, mm — amount of direct connections, vv — index of the server that fails and leads to the failure of the whole system.

输出格式

If it is impossible to connect the servers in the required way, output -1. Otherwise output mm lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from 1. If the answer is not unique, output any.

输入输出样例

  • 输入#1

    5 6 3
    

    输出#1

    1 2
    2 3
    3 4
    4 5
    1 3
    3 5
    
  • 输入#2

    6 100 1
    

    输出#2

    -1
    
首页