违规紫衫
#include<bits/stdc++.h>
#define _________ using
#define __________ namespace
_________ __________ std;
struct _ {
int ___1,___2;
};
int main() {
int ___________=0;
int _____,_________________________;
cin>>_____>>_________________________;
int __________________________[100][100]= {0},_______________________________[_____+1],_________________________________[_____+1],_____________________________[_____+1]= {0},__________________________________[_____+1]= {0},________________________________[_____+1]= {0},___________________________[_____+1]= {0};
bool ____________________________[_____];
_ __[_____];
___________=0;
while( ___________<_____) {
cin>>_______________________________[___________]>>_________________________________[___________];
___________++;
}
___________=0;
while( ___________<_________________________) {
int ___________________________________,____________________________________;
cin>>___________________________________>>____________________________________;
cin>>__________________________[___________________________________-1][____________________________________-1];
___________++;
__________________________________[____________________________________-1]++;
____________________________[___________________________________-1]=1;
}
___________=0;
while( ___________<_____ ) {
if(__________________________________[___________]==0)_____________________________[___________]=1;
___________++;
}
int ___;
while(1) {
int ______________________________=0;
___=0;
while(___<_____) {
__[___].___1=0;
if(_____________________________[___]&&!____________________________[___])__[___].___1=___,__[___].___2=_______________________________[___];
if(_____________________________[___]) {
___++;
continue;
}
_____________________________[___]=1;
_______________________________[___]=-_________________________________[___];
for(; ________________________________[___]<_____; ________________________________[___]++) {
if(__________________________[________________________________[___]][___]==0)continue;
if(!_____________________________[________________________________[___]]) {
_____________________________[___]=0;
}
_______________________________[___]+=max(_______________________________[________________________________[___]],0)*__________________________[________________________________[___]][___];
}
if(!_____________________________[___])______________________________=1;
if(_____________________________[___]&&!____________________________[___])__[___].___1=___,__[___].___2=_______________________________[___];
}
if(!______________________________)break;
}
___________=0;
while( ___________<_____) {
___________________________[__[___________].___1]=__[___________].___2;
___________++;
}
int ______________________________=1;
___________=0;
while( ___________<_____) {
if(___________________________[___________]>0) {
______________________________=0;
cout<<___________+1<<" "<<___________________________[___________]<<"\n";
}
___________++;
}
if(______________________________)cout<<"NULL";
return 0;
}