function Main(input) {
    var menbers = {}
    var res = true;
    input.split(/\n/).slice(1).forEach(line => {
        var fn = line.split(/\s/).map(str => {
            return Number(str);
        });
        if (menbers[fn[0]] !== undefined && menbers[fn[1]] !== undefined) {
            res = (menbers[fn[1]] - menbers[fn[0]]) === fn[2];
        } else if (menbers[fn[0]] !== undefined) {
            menbers[fn[1]] = menbers[fn[0]] + fn[2];
        } else if (menbers[fn[1]] !== undefined) {
            menbers[fn[0]] = menbers[fn[1]] - fn[2];
        } else {
            menbers[fn[0]] = 0;
            menbers[fn[1]] = menbers[fn[0]] + fn[2];
        }
    });
    console.log(res ? 'Yes' : 'No');
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));