#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,m; cin>>n>>m; vector a(n),b(n),c(n); vector x(m),y(m),z(m); rep(i,n) cin>>a[i]>>b[i]>>c[i]; rep(i,m) cin>>x[i]>>y[i]>>z[i]; bitset<1030301> stl; rep(i,n){ stl[a[i]+101*b[i]+101*101*c[i]]=1; } int ans=n; rep(j,m){ int tmp=0; tmp=(stl&(stl>>abs(x[j]+101*y[j]+101*101*z[j]))).count(); ans=max(ans,n*2-tmp); } cout<