#include #define debug(x) cerr << #x << ": " << x << '\n' #define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n' using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vll; const ll INF = LLONG_MAX/2; const ll MOD = 1e9+7; struct FordFulkerson { typedef long long flow_type; struct edge { int src, dst; flow_type capacity, flow; size_t rev; }; int n; vector> adj; FordFulkerson(int n) : n(n), adj(n) { } void add_edge(int src, int dst, flow_type capacity) { adj[src].push_back({src, dst, capacity, 0, adj[dst].size()}); adj[dst].push_back({dst, src, 0, 0, adj[src].size()-1}); } flow_type max_flow(int s, int t) { vector visited(n); function augment = [&](int u, flow_type cur) { if (u == t) return cur; visited[u] = true; for (auto &e: adj[u]) { if (!visited[e.dst] && e.capacity > e.flow) { flow_type f = augment(e.dst, min(e.capacity - e.flow, cur)); if (f > 0) { e.flow += f; adj[e.dst][e.rev].flow -= f; return f; } } } return flow_type(0); }; for (int u = 0; u < n; ++u) for (auto &e: adj[u]) e.flow = 0; flow_type flow = 0; while (1) { fill(visited.begin(),visited.end(), false); flow_type f = augment(s, INF); if (f == 0) break; flow += f; } return flow; } }; signed main(){ cin.tie(0); ios::sync_with_stdio(false); ll W;cin>>W; ll N;cin>>N; vll J(N); for(ll i=0;i>J[i]; ll M;cin>>M; vll C(M); for(ll j=0;j>C[j]; FordFulkerson g(N+M+2); ll src=N+M,dst=N+M+1; for(ll i=0;i>Q; bool ng[N]={}; for(ll q=0;q>x;x--; ng[x]=true; } for(ll i=0;i=W? "SHIROBAKO":"BANSAKUTSUKITA")<