#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
struct car {
  int p, id;
  long long fr;
  car(const int &_p = 0, const long long &_fr = 0, const int &_id = 0) {
    p = _p;
    fr = _fr;
    id = _id;
  }
  bool operator<(const car &rhs) const {
    if (p == rhs.p) {
      if (fr == rhs.fr) return id < rhs.id;
      return fr < rhs.fr;
    }
    return p < rhs.p;
  }
};
set<car> st;
set<pair<long long, car> > st2;
int n, x[maxn], k, Q;
int main() {
  scanf("%d%d%d", &n, &k, &Q);
  for (int i = 1; i <= k; ++i) {
    scanf("%d", x + i);
    st.insert(car(x[i], 0, i));
  }
  long long ti;
  int a, b;
  while (Q--) {
    scanf("%lld%d%d", &ti, &a, &b);
    vector<pair<long long, car> > er;
    for (auto x : st2) {
      if (x.first <= ti)
        er.push_back(x);
      else
        break;
    }
    for (auto x : er) st.insert(x.second), st2.erase(x);
    if (st.size() == 0) {
      long long s = st2.begin()->first;
      auto itr = st2.lower_bound(pair<long long, car>(s, car(a, 0, 0)));
      auto res = itr;
      if (itr != st2.begin()) {
        auto itl = itr;
        --itl;
        if (itr == st2.end() || itr->first != s)
          res = st2.lower_bound(pair<long long, car>(s, car(itl->second.p)));
        else if (a - itl->second.p < itr->second.p - a)
          res = st2.lower_bound(pair<long long, car>(s, car(itl->second.p)));
        else if (a - itl->second.p == itr->second.p - a) {
          itl = st2.lower_bound(pair<long long, car>(s, car(itl->second.p)));
          if (itl->second.fr != itr->second.fr)
            res = itl->second.fr < itr->second.fr ? itl : itr;
          else
            res = itl->second.id < itr->second.id ? itl : itr;
        }
      }
      printf("%d %lld\n", res->second.id, s - ti + abs(res->second.p - a));
      long long bk = s + abs(res->second.p - a) + abs(a - b);
      pair<long long, car> ins =
          pair<long long, car>(bk, car(b, bk, res->second.id));
      st2.erase(res);
      st2.insert(ins);
      continue;
    }
    auto itr = st.lower_bound(car(a));
    auto res = itr;
    if (itr != st.begin()) {
      auto itl = itr;
      --itl;
      if (itr == st.end())
        res = st.lower_bound(car(itl->p));
      else if (a - itl->p < itr->p - a)
        res = st.lower_bound(car(itl->p));
      else if (a - itl->p == itr->p - a) {
        itl = st.lower_bound(car(itl->p));
        if (itl->fr != itr->fr)
          res = itl->fr < itr->fr ? itl : itr;
        else
          res = itl->id < itr->id ? itl : itr;
      }
    }
    printf("%d %d\n", res->id, abs(res->p - a));
    long long bk = ti + abs(a - b) + abs(res->p - a);
    car ins = car(b, bk, res->id);
    st.erase(res);
    st2.insert(pair<long long, car>(bk, ins));
  }
  return 0;
}
