#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 using ll=long long; constexpr ll mod = 1e9 + 7; constexpr ll INF = 1LL << 50; 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(){ int n,m,k; cin>>n>>m>>k; int a; vector>dp(n+1,vector(k+1)); dp[0][0]=true; rep(i,n){ rep(j,m){ cin>>a; for(int h=a;h<=k;++h){ if(dp[i][h-a])dp[i+1][h]=true; } } } for(int i=k;i>=0;--i){ if(dp[n][i]){ cout<