#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,a) for(int i=(int)0;i<(int)a;++i) #define pb push_back #define eb emplace_back #define all(x) x.begin(),x.end() using ll=long long; constexpr ll mod = 1e9 + 7; constexpr ll INF = 1LL << 60; ll gcd(ll n, ll m) { ll tmp; while (m!=0) { tmp = n % m; n = m; m = tmp; } return n; } ll lcm(ll n, ll m) { return abs(n) / gcd(n, m)*abs(m);//gl=xy } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; void solve(){ ll n,m; cin>>n>>m; vector>a(m,vector(n)); rep(i,m){ rep(j,n)cin>>a[i][j]; } bool ok=false; rep(i,m){ vectorsum(n+1); if(i)rep(j,n)a[i][j]+=a[i-1][j]; rep(j,n)sum[j+1]=sum[j]+a[i][j]; rep(j,n){ ll x=sum[j]+777; auto y=lower_bound(all(sum),x); if(*y==777+sum[j])ok=true; } } if(ok)cout<<"YES\n"; else cout<<"NO\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout<