#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, ll> pii;

const int MAXN = 1e6+5;
const ll INF = 1000000000000000000;

int x = -1, n, m, r, c;
ll mini = 0, maxi = 0;
bool vis[MAXN];

vector<int> d;
vector<pii> graph[MAXN];

ll func[MAXN][2], p[MAXN];

void dfs(int v) {
    vis[v] = true;
    d.push_back(v);
    
    for (int i = 0; i < graph[v].size(); ++i) {
        if (!vis[graph[v][i].first]) {
            int u = graph[v][i].first;
            func[u][1] = -func[v][1];
            func[u][0] = graph[v][i].second - func[v][0];
            dfs(graph[v][i].first);
        }
        else {
            int u = graph[v][i].first;
            if (func[v][1] != func[u][1]) {
                if (func[v][0] != graph[v][i].second-func[u][0]) {
                    cout << "No\n"; exit(0);
                }
            } else {
                if ((func[u][0] + func[v][0] + graph[v][i].second)%2 != 0) {
                    cout << "No\n"; exit(0);
                }

                ll val = ((graph[v][i].second - func[u][0] - func[v][0])/(func[v][1]+func[u][1]));
                if (val < 0) {
                    cout << "No\n"; exit(0);
                }
                if (x != -1 && x != val) {
                    cout << "No\n"; exit(0);
                }

                x = val;
            }
        }
    }
    
    // cout << v << ' ' << func[v][0] << ' ' << func[v][1] << endl;
}

int main() {
	scanf("%d%d", &r, &c);
	n = r+c;
    scanf("%d", &m);

    for (int i = 0; i < n; ++i)
    	p[i] = INF;

    for (int i = 0; i < m; ++i) {
        int a, b, x; scanf("%d%d%d", &a, &b, &x);
        a--; b--;
        graph[a].push_back(make_pair(b+r, x));
        graph[b+r].push_back(make_pair(a, x));
    }

    for (int i = 0; i < n; ++i) {
        if (vis[i])
            continue;
        x = -1; func[i][0] = 0, func[i][1] = 1;
        // means the function is x + 0, as intended.
        dfs(i); 

        ll m1 = 0, m2 = 0;

        if (x != -1) {
            m2 = 0;
            for (int j = 0; j < d.size(); ++j) {
                int v = d[j];
                ll value = func[v][1]*x + func[v][0];
                if (value > p[v] || value < 0) {
                    cout << "No\n"; exit(0);
                }

                m1 += p[v]-value, m2 += p[v]-value;
            }
        } else {
            ll tot1 = 0, tot2 = 0;
            ll mx = 0, nx = 1e18;

            for (int j = 0; j < d.size(); ++j) {
                int v = d[j];
                tot1 += p[v]-func[v][0], tot2 -= func[v][1];
                ll a, b;
                if (func[v][1] == 1)
                    a = max(0LL, -func[v][0]), b = p[v]-func[v][0];
                else
                    b = min(func[v][0], (ll)1e18), a = func[v][0]-p[v];

                nx = min(nx, b); mx = max(mx, a);
            }

            if (mx > nx) {
                cout << "No\n"; exit(0);
            }

            m2 = max(mx*tot2 + tot1, nx*tot2 + tot1);
            m1 = min(mx*tot2 + tot1, nx*tot2 + tot1);

            m1 = max(m1, 0LL);
        }

        mini += m1, maxi += m2;

        d.clear();
    }

    cout << "Yes\n";
}

Measured memory_bytes: 37496