#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int bit[N], n, m, k;
int get(int idx) {
  int ret = 0;
  while (idx > 0) {
    ret += bit[idx];
    idx -= idx & -idx;
  }
  return ret;
}
void update(int idx, int val) {
  while (idx <= n) {
    bit[idx] += val;
    idx += idx & -idx;
  }
}
struct event {
  long long t;
  int house, idx;
  bool person;
  event(int pos, long long a, int b, bool c) {
    idx = pos;
    t = a;
    house = b;
    person = c;
  }
};
bool operator<(event a, event b) {
  if (a.t != b.t) return a.t < b.t;
  if (a.person != b.person) return a.person < b.person;
  if (a.idx != b.idx) return a.idx < b.idx;
  if (a.house != b.house) return a.house != b.house;
  return 0;
}
priority_queue<pair<long long, long long> > q[N];
queue<pair<long long, long long> > waiting;
pair<long long, long long> sol[N];
int a[N], b[N];
int get_closest(int idx) {
  int low = 0, high = n + 1;
  while (low + 1 < high) {
    int mid = (low + high) / 2;
    int lft = get(idx + 1) - get(max(0, idx - mid - 1));
    int rgt = get(min(n, idx + mid)) - get(idx - 1);
    if (lft > 0 || rgt > 0)
      high = mid;
    else
      low = mid + 1;
  }
  int cur = get(idx);
  int lft = get(idx) - get(max(0, idx - low - 1));
  int rgt = get(min(n, idx + low)) - get(idx - 1);
  if (lft > 0 || rgt > 0) return low;
  return high;
}
set<event> st;
void solve(int idx, long long late, int qidx, long long t) {
  pair<long long, long long> top = q[qidx].top();
  q[qidx].pop();
  top.first *= -1;
  top.second *= -1;
  update(qidx, -1);
  sol[idx] = pair<long long, long long>(late, top.second);
  st.insert(event(top.second, t + abs(b[idx] - a[idx]) + abs(a[idx] - qidx),
                  b[idx], 0));
}
int main() {
  scanf("%d%d%d", &n, &k, &m);
  for (int i = 1; i <= k; i++) {
    int a;
    scanf("%d", &a);
    update(a, 1);
    q[a].push(pair<long long, long long>(0, -i));
  }
  for (int i = 0; i < m; i++) {
    long long tim;
    scanf("%I64d%d%d", &tim, &a[i], &b[i]);
    st.insert(event(i, tim, a[i], 1));
  }
  int sum = 0;
  while (sum < m && !st.empty()) {
    event x = *st.begin();
    vector<event> v;
    long long curT = x.t;
    while (!st.empty() && (*st.begin()).t == x.t) {
      v.push_back(*st.begin());
      st.erase(st.begin());
    }
    int i = 0;
    while (i < v.size() && v[i].person == 0) {
      int idx = v[i].house;
      int id = v[i].idx;
      q[idx].push(pair<long long, long long>(-curT, -id));
      update(idx, 1);
      i++;
    }
    for (; i < v.size(); i++) {
      int id = v[i].idx;
      long long arrival = v[i].t;
      waiting.push(pair<long long, long long>(arrival, id));
    }
    while (!waiting.empty() && get(n) > 0) {
      sum++;
      pair<long long, long long> cur = waiting.front();
      waiting.pop();
      int idx = a[cur.second], pos = get_closest(a[cur.second]);
      int rgt = pos + idx, lft = idx - pos;
      long long late = curT - cur.first;
      bool golft = 0, gorgt = 0;
      if (lft > 0 && !q[lft].empty() > 0) golft = 1;
      if (rgt <= n && !q[rgt].empty() > 0) gorgt = 1;
      if (pos == 0) golft = 0;
      if (gorgt && golft) {
        pair<long long, long long> a = q[lft].top();
        pair<long long, long long> b = q[rgt].top();
        a.first *= -1;
        b.first *= -1;
        a.second *= -1;
        b.second *= -1;
        int taken = 0;
        if (a.first != b.first) {
          if (a.first > b.first) taken = 1;
        } else {
          if (a.second > b.second) taken = 1;
        }
        solve(cur.second, late + pos, taken == 1 ? rgt : lft, curT);
      } else if (gorgt) {
        solve(cur.second, late + pos, rgt, curT);
      } else if (golft) {
        solve(cur.second, late + pos, lft, curT);
      } else
        cout << "ERROR\n";
    }
  }
  for (int i = 0; i < m; i++) {
    printf("%I64d %I64d\n", sol[i].second, sol[i].first);
  }
  return 0;
}
