Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Youth Hostel Dorm
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 443Accepted: 114Special Judge

Description

The Utrecht Youth Hostel has a giant dorm which usually accommodates all customers easily. With nwerc in town, however, lots of people would like to stay there and all the space available in the dorm should be used as efficiently as possible. You are assigned to provide the dorm layout.

The size of the dorm is given and the layout should consist of a map of that particular size. The map should display one ‘E’, the point of entrance of the dorm, and furthermore ‘B’s and ‘.’s, indicating beds and empty spaces. The entrance should be located somewhere on the boundary of the dorm and every single bed should be reachable by starting at the entrance and walking through empty squares only. You can only walk in vertical and horizontal directions.

The provided layout should contain as many beds as possible.

Input

On the first line one positive number: the number of testcases, at most 100. After that per testcase:

  • One line with two integers l and w with 1 ≤ l, w ≤ 8: the size of the dorm.

Output

Per testcase:

  • l lines with w characters: the dorm layout. Any layout with the maximum number of beds is correct.

Sample Input

3
1 1
4 7
3 8

Sample Output

E
B.B.BEB
B.BBB.B
B.....B
B.BBB.B
BBBBBBBB
.......E
BBBBBBBB

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator