#include <bits/stdc++.h>
using namespace std;
long long gcd(long long u, long long v) {
  if (u < v) swap(u, v);
  while (v != 0) {
    int r = u % v;
    u = v;
    v = r;
  }
  return u;
}
pair<int, int> row[200000], col[200000];
int main(void) {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < 200000; ++i) {
    row[i] = make_pair(0, -1);
    col[i] = make_pair(0, -1);
  }
  int t = 0;
  for (int i = 0; i < k; ++i) {
    t++;
    int q;
    cin >> q;
    if (q == 1) {
      int r, a;
      cin >> r >> a;
      r--;
      row[r] = make_pair(a, t);
    } else if (q == 2) {
      int c, a;
      cin >> c >> a;
      c--;
      col[c] = make_pair(a, t);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (row[i].second > col[j].second)
        cout << row[i].first;
      else
        cout << col[j].first;
      if (j != m - 1) cout << " ";
    }
    cout << endl;
  }
  return 0;
}
