import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.BitSet; import java.util.Comparator; public class Main { public static int[][] cap; public static BitSet used; public static int n; public static int m; public static void main(String[] args) throws NumberFormatException, IOException { ContestScanner in = new ContestScanner(); int w = in.nextInt(); n = in.nextInt(); int[] J = new int[n]; for(int i=0; i 1+n+j にJ[i]をはる node[1+j].createEdge(node[1+n+i]); node[1+n+i].createEdge(node[1+j]); cap[1+j][1+n+i] = J[j]; } node[1+n+i].createEdge(node[1+n+m]); node[1+n+m].createEdge(node[1+n+i]); cap[1+n+i][1+n+m] = C[i]; } int res = 0; while(true){ used = new BitSet(nodes); // used.set(0); int flow = dfs(node[0], 10000000); if(flow == 0) break; res += flow; } System.err.println(res); System.out.println(res >= w ? "SHIROBAKO" : "BANSAKUTSUKITA"); } public static int dfs(Node node, int f){ if(node.id == 1 + n + m) return f; if(used.get(node.id)) return 0; used.set(node.id); for(Node nd: node.edge){ if(cap[node.id][nd.id] > 0){ int flow = dfs(nd, Math.min(f, cap[node.id][nd.id])); if(flow > 0){ // ここが機能しているか怪しい // if(node.id > nd.id) cap[nd.id][node.id]+=flow; // else cap[node.id][nd.id]-=flow; return flow; } } } return 0; } } class Node{ int id; int sink; ArrayList edge = new ArrayList(); public Node(int id) { this.id = id; } public void createEdge(Node node) { edge.add(node); } } class MyComp implements Comparator { final int idx; public MyComp(int idx){ this.idx = idx; } public int compare(int[] a, int[] b) { return a[idx] - b[idx]; } } class Reverse implements Comparator { public int compare(Integer arg0, Integer arg1) { return arg1 - arg0; } } class ContestWriter { private PrintWriter out; public ContestWriter(String filename) throws IOException { out = new PrintWriter(new BufferedWriter(new FileWriter(filename))); } public ContestWriter() throws IOException { out = new PrintWriter(System.out); } public void println(String str) { out.println(str); } public void println(Object obj) { out.println(obj); } public void print(String str) { out.print(str); } public void print(Object obj) { out.print(obj); } public void close() { out.close(); } } class ContestScanner { private BufferedReader reader; private String[] line; private int idx; public ContestScanner() throws FileNotFoundException { reader = new BufferedReader(new InputStreamReader(System.in)); } public ContestScanner(String filename) throws FileNotFoundException { reader = new BufferedReader(new InputStreamReader(new FileInputStream( filename))); } public String nextToken() throws IOException { if (line == null || line.length <= idx) { line = reader.readLine().trim().split(" "); idx = 0; } return line[idx++]; } public String readLine() throws IOException{ return reader.readLine(); } public long nextLong() throws IOException, NumberFormatException { return Long.parseLong(nextToken()); } public int nextInt() throws NumberFormatException, IOException { return (int) nextLong(); } public double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(nextToken()); } }