#include <iostream>
using namespace std;
int main() {
// your code goes here
return 0;
}
template <class ED>
struct EdgeData {
EdgeData(int indexTo, const ED& edgeData) : indexTo(indexTo), edgeData(edgeData) {}
EdgeData(int indexTo, ED&& edgeData) : indexTo(indexTo), edgeData(move(edgeData)) {}
bool operator<(const EdgeData<ED>& other) { return indexTo < other.indexTo; }
int indexTo;
ED edgeData;
};
/*
template <class ED>
struct EdgeData {
EdgeData(int indexTo, const ED& edgeData) : indexTo(indexTo), edgeData(edgeData) {}
EdgeData(int indexTo, ED&& edgeData) : indexTo(indexTo), edgeData(move(edgeData)) {}
int indexTo;
ED edgeData;
};
template <class ED>
bool operator<(const EdgeData<ED>& l, const EdgeData<ED>& r) { return l.indexTo < r.indexTo; }*/
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglyZXR1cm4gMDsKfQoKdGVtcGxhdGUgPGNsYXNzIEVEPgpzdHJ1Y3QgRWRnZURhdGEgewogICAgRWRnZURhdGEoaW50IGluZGV4VG8sIGNvbnN0IEVEJiBlZGdlRGF0YSkgOiBpbmRleFRvKGluZGV4VG8pLCBlZGdlRGF0YShlZGdlRGF0YSkge30KICAgIEVkZ2VEYXRhKGludCBpbmRleFRvLCBFRCYmIGVkZ2VEYXRhKSA6IGluZGV4VG8oaW5kZXhUbyksIGVkZ2VEYXRhKG1vdmUoZWRnZURhdGEpKSB7fQogICAgYm9vbCBvcGVyYXRvcjwoY29uc3QgRWRnZURhdGE8RUQ+JiBvdGhlcikgeyByZXR1cm4gaW5kZXhUbyA8IG90aGVyLmluZGV4VG87IH0KICAgIGludCBpbmRleFRvOwogICAgRUQgZWRnZURhdGE7Cn07Ci8qCnRlbXBsYXRlIDxjbGFzcyBFRD4Kc3RydWN0IEVkZ2VEYXRhIHsKICAgIEVkZ2VEYXRhKGludCBpbmRleFRvLCBjb25zdCBFRCYgZWR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