#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long int x) {
  if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
  for (int i = 5; i * i <= x; i += 6)
    if (x % i == 0 || x % (i + 2) == 0) return 0;
  return 1;
}
inline void boostIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
}
const int INF = int(1e17 + 7);
int gcd(int a, int b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
int optpow(int a, int b, int k) {
  if (b == 0) return 1;
  int tmp = optpow(a, b / 2, k);
  if (b % 2 == 1) {
    return ((tmp * tmp) % k * a) % k;
  } else {
    return (tmp * tmp) % k;
  }
}
int qckpow(int a, int b) {
  if (b == 0) return 1;
  int tmp = qckpow(a, b / 2);
  if (b % 2 == 1) {
    return ((tmp * tmp) * a);
  } else {
    return (tmp * tmp);
  }
}
bool bigger(string a, string b) {
  if (a.size() == b.size()) return a > b;
  return a.size() > b.size();
}
string max_str(string a, string b) {
  if (bigger(a, b)) return a;
  return b;
}
string min_str(string a, string b) {
  if (bigger(a, b)) return b;
  return a;
}
vector<int> strtovec(string s) {
  vector<int> v;
  for (int i = 0; i < s.size(); i++) {
    v.push_back((int)(s[i] - 48));
  }
  return v;
}
string vectostr(vector<int> a) {
  string s;
  for (int i = 0; i < a.size(); i++) {
    s += to_string(a[i]);
  }
  return s;
}
vector<vector<int>> mult(vector<vector<int>> p, vector<vector<int>> f,
                         const int n, const int mod) {
  vector<vector<int>> d;
  d = p;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      p[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        p[i][j] = (p[i][j] + (d[i][k] * f[k][j])) % mod;
      }
    }
  }
  return p;
}
vector<vector<int>> quickpow(vector<vector<int>> p, int s, const int n,
                             const int m) {
  if (s == 0) {
    vector<vector<int>> tmp(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
      tmp[i][i] = 1;
    }
    return tmp;
  }
  if (s % 2 == 1) {
    return mult(quickpow(p, s - 1, n, m), p, n, m);
  } else {
    vector<vector<int>> temp(n, vector<int>(n, 0));
    temp = quickpow(p, s / 2, n, m);
    return mult(temp, temp, n, m);
  }
}
int const maxn = 100005;
int tree[maxn * 4];
int sz;
void build(vector<int> a) {
  sz = 1;
  int n = a.size();
  while (sz <= n) sz <<= 1;
  for (int i = 0; i < n; ++i) {
    tree[i + sz] = a[i];
  }
  for (int i = sz - 1; i > 0; --i) tree[i] = tree[2 * i] + tree[2 * i + 1];
}
void upd(int idx, int val) {
  for (tree[idx += sz] = val; idx > 1; idx >>= 1)
    tree[idx >> 1] = max(tree[idx], tree[idx ^ 1]);
}
int get(int l, int r) {
  int res = 0;
  for (l += sz, r += sz; l <= r; l >>= 1, r >>= 1) {
    if (l & 1) res = res + tree[l++];
    if (~r & 1) res = res + tree[r--];
  }
  return res;
}
bool comp1(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
bool comp2(pair<int, int> p1, pair<int, int> p2) {
  if (p1.second == p2.second) return p1.first < p2.first;
  return p1.second < p2.second;
}
string long_mult(string num1, string num2) {
  int len1 = num1.size();
  int len2 = num2.size();
  if (len1 == 0 || len2 == 0) return "0";
  vector<int> result(len1 + len2, 0);
  int i_n1 = 0;
  int i_n2 = 0;
  for (int i = len1 - 1; i >= 0; i--) {
    int carry = 0;
    int n1 = num1[i] - '0';
    i_n2 = 0;
    for (int j = len2 - 1; j >= 0; j--) {
      int n2 = num2[j] - '0';
      int sum = n1 * n2 + result[i_n1 + i_n2] + carry;
      carry = sum / 10;
      result[i_n1 + i_n2] = sum % 10;
      i_n2++;
    }
    if (carry > 0) result[i_n1 + i_n2] += carry;
    i_n1++;
  }
  int i = result.size() - 1;
  while (i >= 0 && result[i] == 0) i--;
  if (i == -1) return "0";
  string s = "";
  while (i >= 0) s += std::to_string(result[i--]);
  return s;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
const int modulo = 1000000000000007;
bool comp(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
string long_sum(string str1, string str2) {
  if (str1.length() > str2.length()) swap(str1, str2);
  string str = "";
  int n1 = str1.length(), n2 = str2.length();
  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  int carry = 0;
  for (int i = 0; i < n1; i++) {
    int sum = ((str1[i] - '0') + (str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  for (int i = n1; i < n2; i++) {
    int sum = ((str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  if (carry) str.push_back(carry + '0');
  reverse(str.begin(), str.end());
  return str;
}
const int N = 300 + 5;
int n, m, ok, a[N], used[N];
inline bool read() {
  if (scanf("%d %d %d", &n, &m, &ok) != 3) return false;
  for (int i = 0; i < ok; i++) scanf("%d", &a[i]), a[i]--;
  sort(a, a + ok);
  return true;
}
vector<int> g[N];
vector<pair<int, int>> edges;
vector<pair<int, int>> ans;
void dfs(int s, int prev = -1) {
  if (used[s]) return;
  used[s] = true;
  if (prev != -1) {
    ans.push_back(make_pair(min(s, prev), max(s, prev)));
  }
  for (int i = 0; i < g[s].size(); i++) {
    int v = g[s][i];
    if (v == prev) continue;
    dfs(v, s);
  }
}
void add_edge(int i, int j) {
  g[i].push_back(j);
  g[j].push_back(i);
  edges.push_back(make_pair(min(i, j), max(j, i)));
}
inline void solve() {
  if (n == ok) {
    puts("-1");
    return;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (i == a[1] || j == a[0] || i == a[0] || j == a[1]) continue;
      add_edge(i, j);
    }
  for (int i = 0; i < n; i++) {
    if (!binary_search(a, a + ok, i)) {
      add_edge(i, a[0]);
      add_edge(i, a[1]);
    } else {
      if (i != a[0] && i != a[1]) add_edge(i, a[0]);
    }
  }
  for (int i = 0; i < n; i++) {
    if (!binary_search(a, a + ok, i)) {
      dfs(i);
      sort(ans.begin(), ans.end());
      break;
    }
  }
  if (edges.size() < m) {
    puts("-1");
    return;
  }
  for (int i = 0; i < edges.size(); i++) {
    if (!binary_search(ans.begin(), ans.begin() + n - 1, edges[i]) &&
        ans.size() < m) {
      ans.push_back(edges[i]);
    }
  }
  for (int i = 0; i < ans.size(); i++) {
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
}
int32_t main() {
  while (read()) solve();
}

### Prompt

Your task is to create a CPP solution to the following problem:

Valera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it.

Valera's already written the code that counts the shortest distance between any pair of vertexes in a non-directed connected graph from n vertexes and m edges, containing no loops and multiple edges. Besides, Valera's decided to mark part of the vertexes. He's marked exactly k vertexes a1, a2, ..., ak.

Valera's code is given below.
    
    
      
    ans[i][j] // the shortest distance for a pair of vertexes i, j  
    a[i]  // vertexes, marked by Valera  
      
    for(i = 1; i <= n; i++) {  
        for(j = 1; j <= n; j++) {  
            if (i == j)  
                ans[i][j] = 0;  
            else  
                ans[i][j] = INF;  //INF is a very large number   
        }  
    }      
      
    for(i = 1; i <= m; i++) {  
        read a pair of vertexes u, v that have a non-directed edge between them;  
        ans[u][v] = 1;  
        ans[v][u] = 1;  
    }  
      
    for (i = 1; i <= k; i++) {  
        v = a[i];  
        for(j = 1; j <= n; j++)  
            for(r = 1; r <= n; r++)  
                ans[j][r] = min(ans[j][r], ans[j][v] + ans[v][r]);  
    }  
    

Valera has seen that his code is wrong. Help the boy. Given the set of marked vertexes a1, a2, ..., ak, find such non-directed connected graph, consisting of n vertexes and m edges, for which Valera's code counts the wrong shortest distance for at least one pair of vertexes (i, j). Valera is really keen to get a graph without any loops and multiple edges. If no such graph exists, print -1.

Input

The first line of the input contains three integers n, m, k (3 ≤ n ≤ 300, 2 ≤ k ≤ n , <image>) — the number of vertexes, the number of edges and the number of marked vertexes. 

The second line of the input contains k space-separated integers a1, a2, ... ak (1 ≤ ai ≤ n) — the numbers of the marked vertexes. It is guaranteed that all numbers ai are distinct.

Output

If the graph doesn't exist, print -1 on a single line. Otherwise, print m lines, each containing two integers u, v — the description of the edges of the graph Valera's been looking for.

Examples

Input

3 2 2
1 2


Output

1 3
2 3


Input

3 3 2
1 2


Output

-1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long int x) {
  if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
  for (int i = 5; i * i <= x; i += 6)
    if (x % i == 0 || x % (i + 2) == 0) return 0;
  return 1;
}
inline void boostIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
}
const int INF = int(1e17 + 7);
int gcd(int a, int b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
int optpow(int a, int b, int k) {
  if (b == 0) return 1;
  int tmp = optpow(a, b / 2, k);
  if (b % 2 == 1) {
    return ((tmp * tmp) % k * a) % k;
  } else {
    return (tmp * tmp) % k;
  }
}
int qckpow(int a, int b) {
  if (b == 0) return 1;
  int tmp = qckpow(a, b / 2);
  if (b % 2 == 1) {
    return ((tmp * tmp) * a);
  } else {
    return (tmp * tmp);
  }
}
bool bigger(string a, string b) {
  if (a.size() == b.size()) return a > b;
  return a.size() > b.size();
}
string max_str(string a, string b) {
  if (bigger(a, b)) return a;
  return b;
}
string min_str(string a, string b) {
  if (bigger(a, b)) return b;
  return a;
}
vector<int> strtovec(string s) {
  vector<int> v;
  for (int i = 0; i < s.size(); i++) {
    v.push_back((int)(s[i] - 48));
  }
  return v;
}
string vectostr(vector<int> a) {
  string s;
  for (int i = 0; i < a.size(); i++) {
    s += to_string(a[i]);
  }
  return s;
}
vector<vector<int>> mult(vector<vector<int>> p, vector<vector<int>> f,
                         const int n, const int mod) {
  vector<vector<int>> d;
  d = p;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      p[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        p[i][j] = (p[i][j] + (d[i][k] * f[k][j])) % mod;
      }
    }
  }
  return p;
}
vector<vector<int>> quickpow(vector<vector<int>> p, int s, const int n,
                             const int m) {
  if (s == 0) {
    vector<vector<int>> tmp(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
      tmp[i][i] = 1;
    }
    return tmp;
  }
  if (s % 2 == 1) {
    return mult(quickpow(p, s - 1, n, m), p, n, m);
  } else {
    vector<vector<int>> temp(n, vector<int>(n, 0));
    temp = quickpow(p, s / 2, n, m);
    return mult(temp, temp, n, m);
  }
}
int const maxn = 100005;
int tree[maxn * 4];
int sz;
void build(vector<int> a) {
  sz = 1;
  int n = a.size();
  while (sz <= n) sz <<= 1;
  for (int i = 0; i < n; ++i) {
    tree[i + sz] = a[i];
  }
  for (int i = sz - 1; i > 0; --i) tree[i] = tree[2 * i] + tree[2 * i + 1];
}
void upd(int idx, int val) {
  for (tree[idx += sz] = val; idx > 1; idx >>= 1)
    tree[idx >> 1] = max(tree[idx], tree[idx ^ 1]);
}
int get(int l, int r) {
  int res = 0;
  for (l += sz, r += sz; l <= r; l >>= 1, r >>= 1) {
    if (l & 1) res = res + tree[l++];
    if (~r & 1) res = res + tree[r--];
  }
  return res;
}
bool comp1(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
bool comp2(pair<int, int> p1, pair<int, int> p2) {
  if (p1.second == p2.second) return p1.first < p2.first;
  return p1.second < p2.second;
}
string long_mult(string num1, string num2) {
  int len1 = num1.size();
  int len2 = num2.size();
  if (len1 == 0 || len2 == 0) return "0";
  vector<int> result(len1 + len2, 0);
  int i_n1 = 0;
  int i_n2 = 0;
  for (int i = len1 - 1; i >= 0; i--) {
    int carry = 0;
    int n1 = num1[i] - '0';
    i_n2 = 0;
    for (int j = len2 - 1; j >= 0; j--) {
      int n2 = num2[j] - '0';
      int sum = n1 * n2 + result[i_n1 + i_n2] + carry;
      carry = sum / 10;
      result[i_n1 + i_n2] = sum % 10;
      i_n2++;
    }
    if (carry > 0) result[i_n1 + i_n2] += carry;
    i_n1++;
  }
  int i = result.size() - 1;
  while (i >= 0 && result[i] == 0) i--;
  if (i == -1) return "0";
  string s = "";
  while (i >= 0) s += std::to_string(result[i--]);
  return s;
}
int lcm(int a, int b) { return a * b / gcd(a, b); }
const int modulo = 1000000000000007;
bool comp(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
string long_sum(string str1, string str2) {
  if (str1.length() > str2.length()) swap(str1, str2);
  string str = "";
  int n1 = str1.length(), n2 = str2.length();
  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  int carry = 0;
  for (int i = 0; i < n1; i++) {
    int sum = ((str1[i] - '0') + (str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  for (int i = n1; i < n2; i++) {
    int sum = ((str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  if (carry) str.push_back(carry + '0');
  reverse(str.begin(), str.end());
  return str;
}
const int N = 300 + 5;
int n, m, ok, a[N], used[N];
inline bool read() {
  if (scanf("%d %d %d", &n, &m, &ok) != 3) return false;
  for (int i = 0; i < ok; i++) scanf("%d", &a[i]), a[i]--;
  sort(a, a + ok);
  return true;
}
vector<int> g[N];
vector<pair<int, int>> edges;
vector<pair<int, int>> ans;
void dfs(int s, int prev = -1) {
  if (used[s]) return;
  used[s] = true;
  if (prev != -1) {
    ans.push_back(make_pair(min(s, prev), max(s, prev)));
  }
  for (int i = 0; i < g[s].size(); i++) {
    int v = g[s][i];
    if (v == prev) continue;
    dfs(v, s);
  }
}
void add_edge(int i, int j) {
  g[i].push_back(j);
  g[j].push_back(i);
  edges.push_back(make_pair(min(i, j), max(j, i)));
}
inline void solve() {
  if (n == ok) {
    puts("-1");
    return;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (i == a[1] || j == a[0] || i == a[0] || j == a[1]) continue;
      add_edge(i, j);
    }
  for (int i = 0; i < n; i++) {
    if (!binary_search(a, a + ok, i)) {
      add_edge(i, a[0]);
      add_edge(i, a[1]);
    } else {
      if (i != a[0] && i != a[1]) add_edge(i, a[0]);
    }
  }
  for (int i = 0; i < n; i++) {
    if (!binary_search(a, a + ok, i)) {
      dfs(i);
      sort(ans.begin(), ans.end());
      break;
    }
  }
  if (edges.size() < m) {
    puts("-1");
    return;
  }
  for (int i = 0; i < edges.size(); i++) {
    if (!binary_search(ans.begin(), ans.begin() + n - 1, edges[i]) &&
        ans.size() < m) {
      ans.push_back(edges[i]);
    }
  }
  for (int i = 0; i < ans.size(); i++) {
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
}
int32_t main() {
  while (read()) solve();
}

```