| 142 | } |
| 143 | |
| 144 | public static void main(String[] args) throws Exception { |
| 145 | FastReader in = new FastReader(System.in); |
| 146 | PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); |
| 147 | t = 0; |
| 148 | n = in.nextInt(); |
| 149 | m = in.nextInt(); |
| 150 | while (n != 0 || m != 0) { |
| 151 | prepare(); |
| 152 | for (int i = 1; i <= m; i++) { |
| 153 | a[i] = in.nextInt(); |
| 154 | b[i] = in.nextInt(); |
| 155 | addEdge(a[i], b[i]); |
| 156 | addEdge(b[i], a[i]); |
| 157 | } |
| 158 | tarjan(1, 0); |
| 159 | condense(); |
| 160 | dfs(1, 0); |
| 161 | out.println("Case " + (++t) + ":"); |
| 162 | q = in.nextInt(); |
| 163 | for (int i = 1, x, y; i <= q; i++) { |
| 164 | x = in.nextInt(); |
| 165 | y = in.nextInt(); |
| 166 | link(x, y); |
| 167 | out.println(ebccCnt - 1); |
| 168 | } |
| 169 | out.println(); |
| 170 | n = in.nextInt(); |
| 171 | m = in.nextInt(); |
| 172 | } |
| 173 | out.flush(); |
| 174 | out.close(); |
| 175 | } |
| 176 | |
| 177 | // 读写工具类 |
| 178 | static class FastReader { |