QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#656448#9478. Shift Puzzleucup-team008#AC ✓46ms9504kbC++174.9kb2024-10-19 13:01:582024-10-19 13:01:58

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 13:01:58]
  • 评测
  • 测评结果:AC
  • 用时:46ms
  • 内存:9504kb
  • [2024-10-19 13:01:58]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
typedef vector<int> vi;
#define f first
#define s second
#define derr if(0) cerr
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << flush;
// END NO SAD

template<class Fun>
class y_combinator_result {
  Fun fun_;
public:
  template<class T>
  explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}

  template<class ...Args>
  decltype(auto) operator()(Args &&...args) {
    return fun_(std::ref(*this), std::forward<Args>(args)...);
  }
};

template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
  return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
}

template<class T>
bool updmin(T& a, T b) {
  if(b < a) {
    a = b;
    return true;
  }
  return false;
}
template<class T>
bool updmax(T& a, T b) {
  if(b > a) {
    a = b;
    return true;
  }
  return false;
}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int cnt(vector<string>& g) {
  int r = 0;
  for(auto& a: g) for(auto b: a) r += b == '#';
  return r;
}
void solve() {
  int n;
  cin >> n;
  vector<string> a(n), b(n);
  auto shiftr = [&](int row, int amt) -> void {
    string curr = "";
    for(int i = 0; i < n; i++) curr += a[row][i];
    for(int i = 0; i < n; i++) a[row][(i+amt)%n] = curr[i];
  };
  auto shiftd = [&](int col, int amt) -> void {
    string curr = "";
    for(int i = 0; i < n; i++) curr += a[i][col];
    for(int i = 0; i < n; i++) a[(i+amt)%n][col] = curr[i];
  };
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> b[i];
  if(cnt(a) != cnt(b)) return void(cout << "No\n");
  cout << "Yes\n";
  vector<array<int, 2>> abad, bbad;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(a[i][j] == b[i][j]) continue;
      if(a[i][j] == '#') abad.pb({i, j});
      if(b[i][j] == '#') bbad.pb({i, j});
    }
  }
  vector<array<int, 2>> ops;
  assert(sz(abad) == sz(bbad));
  auto doop = [&](int aa, int bb, int n) -> void {
    for(int i = 0; i < n; i++) {
      ops.pb({aa, bb+1});
    }
  };
  auto rot = [&](int xa, int ya, int xb, int yb, bool orient) -> void {
    if(orient) {
      doop(1, xa, (yb - ya + n) % n);
      doop(2, yb, (xa - xb + n) % n);
      doop(1, xa, (ya - yb + n) % n);
      doop(2, yb, (xb - xa + n) % n);
    }
    else {
      doop(2, yb, (xa - xb + n) % n);
      doop(1, xa, (yb - ya + n) % n);
      doop(2, yb, (xb - xa + n) % n);
      doop(1, xa, (ya - yb + n) % n);
    }
  };
  for(int i = 0; i < sz(abad); i++) {
    auto [xa, ya] = abad[i];
    auto [xb, yb] = bbad[i];
    if(xa != xb && ya != yb) {
      rot(xa, ya, xb, yb, a[xa][yb] == '#');
    }
    else if(xa == xb) {
      rot(xa, ya, (xa+1)%n, yb, a[xa][yb] == a[(xa+1)%n][yb]);
    }
    else if(ya == yb) {
      rot(xa, (ya+1)%n, xb, yb, a[xa][(ya+1)%n] == a[xb][yb]);
    }
    else assert(false);
    swap(a[xa][ya], a[xb][yb]);
  }
  assert(sz(ops) <= n*n*n);
  cout << sz(ops) << "\n";
  for(auto [aa, bb]: ops) cout << aa << " " << bb << "\n";
}

// what would chika do
// are there edge cases?
// did you actually sort the thing instead of just thinking it?
// integer overflow?

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

input:

3
.#.
#.#
.#.
#.#
...
#.#

output:

Yes
24
2 1
2 1
1 1
1 1
2 1
1 1
1 2
1 2
2 3
1 2
2 3
2 3
2 1
2 1
1 2
2 1
1 2
1 2
2 3
2 3
1 3
2 3
1 3
1 3

result:

ok AC

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

3
.#.
#.#
.#.
.#.
#.#
.#.

output:

Yes
0

result:

ok AC

Test #3:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

13
.............
....#####....
......#......
......#......
......#......
......#......
.............
....#...#....
....#...#....
....#...#....
....#...#....
.....###.....
.............
....####.....
....#...#....
....####.....
....#........
....#........
.............
.....###.....
....#...#....
......

output:

No

result:

ok AC

Test #4:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

3
#.#
#.#
###
#.#
.#.
###

output:

No

result:

ok AC

Test #5:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

4
.#..
.#..
....
...#
....
..#.
#...
....

output:

No

result:

ok AC

Test #6:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

4
....
....
....
.#..
..##
##.#
####
..##

output:

No

result:

ok AC

Test #7:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

2
..
..
..
..

output:

Yes
0

result:

ok AC

Test #8:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

3
.##
##.
.#.
##.
..#
.##

output:

Yes
18
2 1
2 1
1 1
2 1
1 1
1 1
1 2
1 2
2 3
2 3
1 2
2 3
1 2
2 3
2 3
1 2
1 2
2 3

result:

ok AC

Test #9:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

3
...
#..
..#
...
#..
#..

output:

Yes
6
1 3
2 1
2 1
1 3
1 3
2 1

result:

ok AC

Test #10:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

3
..#
.##
###
#.#
.##
#.#

output:

Yes
6
1 3
1 3
2 1
2 1
1 3
2 1

result:

ok AC

Test #11:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

4
....
#...
...#
#.#.
#...
....
.#..
.##.

output:

Yes
24
1 2
1 2
1 2
2 1
1 2
2 1
2 1
2 1
1 3
1 3
2 2
2 2
2 2
1 3
1 3
2 2
1 4
2 2
2 2
2 2
1 4
1 4
1 4
2 2

result:

ok AC

Test #12:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

4
#.#.
##..
....
#..#
....
...#
.#.#
#.##

output:

Yes
32
2 4
2 4
2 4
1 1
1 1
1 1
2 4
1 1
2 2
2 2
1 1
1 1
1 1
2 2
2 2
1 1
1 2
1 2
1 2
2 4
2 4
2 4
1 2
2 4
2 3
2 3
1 2
2 3
2 3
1 2
1 2
1 2

result:

ok AC

Test #13:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2
.#
.#
#.
#.

output:

Yes
8
1 1
2 1
1 1
2 1
2 1
1 2
2 1
1 2

result:

ok AC

Test #14:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

3
##.
.##
...
...
#..
###

output:

Yes
24
2 1
2 1
1 1
1 1
2 1
1 1
2 1
1 1
1 1
2 1
2 1
1 1
2 2
2 2
1 2
1 2
2 2
1 2
2 3
2 3
1 2
1 2
2 3
1 2

result:

ok AC

Test #15:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

3
.#.
##.
.#.
#.#
..#
#..

output:

Yes
24
2 1
2 1
1 1
1 1
2 1
1 1
2 3
1 2
1 2
2 3
2 3
1 2
1 2
2 3
2 3
1 2
1 2
2 3
2 1
2 1
1 3
1 3
2 1
1 3

result:

ok AC

Test #16:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

3
#.#
#..
#..
.#.
.##
.#.

output:

Yes
24
1 1
2 2
2 2
1 1
1 1
2 2
1 1
1 1
2 2
2 2
1 1
2 2
1 2
1 2
2 3
2 3
1 2
2 3
2 2
2 2
1 3
2 2
1 3
1 3

result:

ok AC

Test #17:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

4
####
#..#
...#
.#..
....
.##.
###.
#.##

output:

Yes
64
1 1
2 2
2 2
2 2
1 1
1 1
1 1
2 2
1 1
2 3
2 3
2 3
1 1
1 1
1 1
2 3
2 1
2 1
1 1
1 1
2 1
2 1
1 1
1 1
2 2
2 2
1 1
1 1
2 2
2 2
1 1
1 1
1 2
1 2
2 3
2 3
2 3
1 2
1 2
2 3
2 1
2 1
1 2
2 1
2 1
1 2
1 2
1 2
1 3
1 3
1 3
2 3
2 3
2 3
1 3
2 3
1 4
1 4
2 4
2 4
2 4
1 4
1 4
2 4

result:

ok AC

Test #18:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

4
.#.#
##..
.#.#
.##.
#.#.
..##
#.#.
#..#

output:

Yes
64
2 1
2 1
2 1
1 1
1 1
1 1
2 1
1 1
1 1
1 1
1 1
2 3
2 3
2 3
1 1
2 3
1 2
1 2
2 3
2 3
2 3
1 2
1 2
2 3
2 4
2 4
2 4
1 2
1 2
2 4
1 2
1 2
1 3
1 3
1 3
2 1
2 1
2 1
1 3
2 1
2 3
2 3
2 3
1 3
1 3
1 3
2 3
1 3
2 1
2 1
2 1
1 4
1 4
1 4
2 1
1 4
1 4
2 4
2 4
2 4
1 4
1 4
1 4
2 4

result:

ok AC

Test #19:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

19
.######.######..###
...###.##.###.#####
.#.####..#.##...###
.#####.##.######.##
.##.#############..
.#.....##..#.##.#.#
#####.###..#.###.##
#.####.#...##..#.##
.######.##.##..####
.#.###.###.###..###
#######.###.#..###.
#####.###.####.##.#
..#.######..###..#.
#.#.#..####..###.#.
########.####..##...

output:

No

result:

ok AC

Test #20:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

21
#####################
#####################
#####################
#####################
#####################
#####################
#####################
#########.###########
#####################
#####################
#####################
#####################
#####################
###########...

output:

No

result:

ok AC

Test #21:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

26
##.###....#######.....#...
.#.##.#####..#..#..###.###
.#.#####.##.##.#.#.##.#..#
###.###...##...#.#....#.#.
.##..###..#.##.#.##..#.#.#
#..##...##.#...####...####
##.#..###.#.####...###....
.##..#..##.##..#.##...#.##
####.###..#.#####..#####..
.#.#.##..###.###..###.####
##.##.#..#..#....###..###.
...

output:

No

result:

ok AC

Test #22:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

35
####.##.###.####..##.##############
####.####.##############.######.###
###########..######.###.######.###.
#.#.####.##.#####...###############
################.#####.############
#######...#.####.###..######.######
#.##.#############.####.######.#.##
##..####.####.#####################
#####.##....

output:

Yes
13720
1 1
1 1
1 1
1 1
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 5
2 8
2 8
2 ...

result:

ok AC

Test #23:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

34
.........#.................#......
...#.#............................
..........#.............#.........
.................................#
.......#..........................
..................................
.......................#..........
.................#................
....................

output:

Yes
2788
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
2 25
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 ...

result:

ok AC

Test #24:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

23
####.####.#.#.#########
..####.##.##.###.######
#.###...#.#.###.###.###
###.#####.####..#######
#.#...##.######..#.#.##
.####.##.###########..#
##.#....##..###.#.#..##
##.#.####...##.###..#.#
##.###..###########.###
###.###..###.#.#.#.##.#
#.####.###..##.#####..#
###.######.##.####..#.#
.###.####...

output:

Yes
5336
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
1 1
1 1
1 1
2 5
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 1...

result:

ok AC

Test #25:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

20
#....###......##...#
.......##...#...#..#
......#.....#.#.....
..#....##.#..#.#....
#..#...#.#...##.#...
...#...#...##.....#.
#####.#........#....
....##...#.#..#.....
.#.#........#....#..
.#.#.###...#........
#.....#..##.##......
##....##..#.........
.#.#..............#.
#..............#..#.
##....

output:

Yes
3240
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 12
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
2 13
1 1
1 1
1 1
1 1
...

result:

ok AC

Test #26:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

12
##..#.......
.#.##.###.#.
##.#..#.####
##.###..###.
.#.#.##.#.##
##.###.#...#
#..###..####
..####.#####
#.#.##.##.#.
.#.##.####..
.#.....#####
###.#..##.#.
.##.#######.
..###.#.####
#.###...##..
.#...##.#.##
.#.#########
#...##.#.##.
.##.##...##.
..####.#.###
...#.#######
..#.......#.
..#.#..##.#...

output:

Yes
792
1 1
1 1
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 3
2 6
1 2
1 2
1 2
1 2
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
2 7
1 2
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 8
...

result:

ok AC

Test #27:

score: 0
Accepted
time: 8ms
memory: 4220kb

input:

44
###...##.#....##.#####.##.##...####.##....##
#.#...##..#.#.##..#.###.......####..#..#..#.
..#.########..##.#.....##.....#..##...#.#.#.
#.#.##.#.#.#.#....#.#.######.#....#......###
#.#.#.##...##.#..#.#..#######.#.###..###.###
###..#...#...#........##..#...#.##..#..#..##
..##.#..#..#####......#..##...

output:

Yes
85184
1 1
1 1
1 1
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 ...

result:

ok AC

Test #28:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

10
##...#.#.#
###....###
#####.#...
....#....#
....#..##.
.#.#..##.#
##.##.#...
#..#..##.#
##..#.#.#.
######.#.#
..###.#.#.
...####...
.....#.###
####.####.
####.##..#
#.#.##..#.
..#..#.###
.##.##..#.
..##.#.#.#
......#.#.

output:

Yes
1000
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
1 1
1 1
2 3
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 4
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
1 1
2 5
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 7
2 7
2 7
2 7...

result:

ok AC

Test #29:

score: 0
Accepted
time: 8ms
memory: 4368kb

input:

44
..#.#.###.#.....#...#.#####.....#....#.#....
####.....#..##...##..#.####.#.#..#..#..#####
#.###.##########.##.#####..#####.#.##....#.#
#..#.##.##..###..#...#.....###.##..##.#.##..
.####.#..##.###.#.###....#..#..######...#.#.
##...#.#.##.##..#.##.####.###.#..#####.#.###
.#..####...##.####.....##.....

output:

Yes
85184
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 ...

result:

ok AC

Test #30:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

10
###..#...#
#.##.##..#
#..#..##.#
..#..###..
#..###...#
.##.##.##.
.##..##...
#.###.##..
.#####....
.#...#.#.#
...##.###.
.#..#..##.
.##.##..#.
##.##...##
.##...###.
#..#..#..#
#..##..###
.#...#..##
#.....####
#.###.#.#.

output:

Yes
1000
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
1 1
1 1
1 1
2 4
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 5
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
1 1
1 1
1 1
1 1
2 7
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 8
2 8
2 8
2 8
2 8
2 8
2 8
2 8
2 8
1 1
1 1...

result:

ok AC

Test #31:

score: 0
Accepted
time: 3ms
memory: 3680kb

input:

30
..#.#..#....##.#..###...##.#..
..###...#####.#..##.##......##
..###.#.####.....#...##..##.#.
#.#....####.#..##...##..###..#
#.##.#.........#.##.#.##......
#.##......##..#.######..##..##
###..#.##..##...#####.##..##.#
#####.#..#...###.....##..#.#.#
##..#.####.####....####......#
##.#..####.#..##.....

output:

Yes
27000
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
1 1
1 1
2 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 ...

result:

ok AC

Test #32:

score: 0
Accepted
time: 10ms
memory: 4368kb

input:

79
###########.#####.#.###################################################.######.
#####.#########.##.###.##.#.######.############.####.##.###########.##..#######
#########.##..########.###.###.##########..################.#########.####.###.
#####.####..##.#####.#.###.######.######################....

output:

Yes
112022
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12...

result:

ok AC

Test #33:

score: 0
Accepted
time: 6ms
memory: 5360kb

input:

79
..........##...............#..#.#...#...#.....##...............................
..#...#......#.........#..##...#.#....##.##.........##.#...#...#......#..##....
.##....#.........#........#...............#....#......#.......#....#..#....#...
...#...##...##...#...#.#.....................#.#............

output:

Yes
133510
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 1
2 1
2 1
2...

result:

ok AC

Test #34:

score: 0
Accepted
time: 10ms
memory: 4240kb

input:

79
.......#..##.#.........#....#....#..#..#.........#.#...........#...............
..#.................#............#...........................#........#.#....#.
#........................#........#........#..................#..##...........#
....#...##.................#......##........................

output:

Yes
99224
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65
2 65...

result:

ok AC

Test #35:

score: 0
Accepted
time: 4ms
memory: 3824kb

input:

79
....................#..........................................................
.............#..#..#.........#............#...............................#....
.......................................................#.......................
.........................#....#......................#.#....

output:

Yes
40922
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 33
2 ...

result:

ok AC

Test #36:

score: 0
Accepted
time: 16ms
memory: 5408kb

input:

79
...#####...######.#####.###...####.#.##.#.#....#..##..########.##.##.#.####..##
.##..##.####.#####.##.#######.####..#####..#..#.#####.#...####.#######.#..###.#
#..####.#.#####.###.####..##..##.#.#####..#.###..#..#....#.####..###.##.###.#.#
.##.####.####..######.###..##.#########.#.##.##.#####.......

output:

Yes
221516
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1...

result:

ok AC

Test #37:

score: 0
Accepted
time: 40ms
memory: 8604kb

input:

79
######.#####.##.....#..##.##.##.##.###.#####..#####.#.#######.##.#.###.#.###.#.
...#.....##.....#...#...#.####....#.#.#.######..#..####.#.#######.###..###.###.
.#.#....##.....##.###.#####...#......#.#..#.#..###.#######.#.##...##..###.#..#.
.##.#.#..##.#...###.##....##......#..#....##.##.#.#.#...#...

output:

Yes
492960
1 1
1 1
1 1
1 1
1 1
1 1
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2 7
2...

result:

ok AC

Test #38:

score: 0
Accepted
time: 37ms
memory: 9388kb

input:

79
..#.#..###.##.#.#.####.#.##.#..#....#...#######.#...#...#....#####..##..##.####
#.#..####.#.#.#..#..#.#....##...#.#..#..#.###.#.#.#.#.....####.####.#..#.#.###.
#...#...#.##.#..##.#####.#.#####.......#######...###.#.#...#.###.####.####..##.
#.##.#..#......##...#.##..#..###.##..#..###..#.##.....##....

output:

Yes
492960
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2...

result:

ok AC

Test #39:

score: 0
Accepted
time: 37ms
memory: 8544kb

input:

79
....#.#.##..#.#...........########..#..#..###########.###..#..####.#.###.#.....
.#..#...#...#.#####.#..##.#.#.#.#...#.##.##.#..##..##########....##.###.####.##
..###..#..###.....#..##..#.....##..##.###....##..####..##..##..#####.#####....#
#.#######..###..###.##.#.#..###########.##..#....#.#.#..#...

output:

Yes
492960
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1...

result:

ok AC

Test #40:

score: 0
Accepted
time: 37ms
memory: 8184kb

input:

79
###..#.#.#...##.##.###...#.####.####...#....#..#...###...#.#..#...#.#.#.##..#..
#####.###....#.#....#.####...#..###..#..#.##.##...#.###..#.#...####.####....#..
##.....#####.#..#.....#.#.#..#.#..#.############..#.#.#...#....#.###.#...##.##.
#.#...#.########..##....#####...##...#.#.#.#..#.#...##......

output:

Yes
492960
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2...

result:

ok AC

Test #41:

score: 0
Accepted
time: 41ms
memory: 7884kb

input:

79
.....###.##.#.#....####.#.###..#.###..#.##...###.##..#.##.#.####......#.###.#..
###.##..###.######.#.##..####.#####.#.#.####..#.##..######..#...#.##....###...#
#...##.####.#..#####..#####.##.#...####.#...####..##.##.#..####....#...#....###
####..###..#.##.......#...#..##.####.##.###...#####.#..#....

output:

Yes
492960
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2...

result:

ok AC

Test #42:

score: 0
Accepted
time: 41ms
memory: 8556kb

input:

79
..##.##.#..#.#.#.#..##.#.....#.#####...####.####..###..##..#....##.#.#...#....#
.###.#.####.###.###..#.#.#.#...#.#####...##..#.##..##..#.####..###.#.##.#.#.###
.##..###..##....#.#..#.#.##.#.##.###..#####.#..#.#.##.####...##....#.###..###..
#..##..###.#.###.###.##.######.#.#........##...##.##..#.#...

output:

Yes
492960
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1...

result:

ok AC

Test #43:

score: 0
Accepted
time: 40ms
memory: 9504kb

input:

79
...##...#..##......##..##....###....#.##..##.##.##..#.#..#.#..##...#........#..
####.#.#.#.#.###....#..#.##.....#.#.###.#.#.#.#...#.#####..##..###.##.#.#######
..#.#.#...#####.#####.#.##..#.#.#..###.##...##.#.#..#...#####.###..##...##..###
.#....#...#..##......#..##....#..##.#..#.##.###..##...#.#...

output:

Yes
492960
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2...

result:

ok AC

Test #44:

score: 0
Accepted
time: 40ms
memory: 8644kb

input:

79
#....#.##.###.....##.#####.#.#..##..#.######.#.###.#.######.#.##.#......#..#.##
.###.##.##......#..###.#.#....#....##.###.#.###.#......#...##..##..##...#.##...
.##.#..##...##...#.#....#...#...##..#.#.#.#...#.#.##...#.###..##.#####..#.#####
..###..#.###......#..#...###..#......###..##.....####..##...

output:

Yes
492960
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2...

result:

ok AC

Test #45:

score: 0
Accepted
time: 43ms
memory: 8412kb

input:

79
...#..####..##.#.#..#.....#..#.####...#.#..#.#....#..#..#.###.#####...#....#.##
..##......##.#.##..#.#.###..####.#.##.#.......##..##.....#.#.#####....#..###.#.
#..#.##.#.#.##..##.####..########.##.#.#..####.#####.##.######.##.#..####..##.#
##...#....##....####.#.#.#..#...##########.###.###.#..###...

output:

Yes
492960
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1...

result:

ok AC

Test #46:

score: 0
Accepted
time: 44ms
memory: 8484kb

input:

79
#...##..#.##..#.#.###..##.###.#####..#.#...###......#..#...#..######.#.#..#.#.#
#..#.##...#.###.#..#...#####.#.#.#...##..##.###..###..####..#.#.#..####.##.#..#
###..#.##..##.###..###.#.##..#..##....##.#..####.##.##..###..#..#.....#..#.##..
.#.#.....##...#.##..###.##.##.##..#..###.##...#.#.#####.#...

output:

Yes
492960
1 1
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2...

result:

ok AC

Test #47:

score: 0
Accepted
time: 19ms
memory: 5340kb

input:

80
##..#..#.#.##.######.####.##...#..#####.#..#.#####.##...#.####.##.##.#.#...#.#..
#.###.#.#.#...#.#...#.#.#.###....#.##.###..#....##.####.##.#####.####.##.##..#..
.###.##.###.##.####..#####..#####.###.#####.##....##.#.#.#..#####.#...###.#.##.#
#.###.###..##.#.##.##...###.#.####...##.###.#...##.#.#...

output:

Yes
251840
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2...

result:

ok AC

Test #48:

score: 0
Accepted
time: 21ms
memory: 5300kb

input:

80
.....#.##...#.#.###.......#..#.#...#..###.#.#..#..#.#...###......####..#.#.#..##
##..##...#.....##.#....###.#..#......###.#...#.##.....#.#.##..##...#....#.......
#.#.#..#.#.##..........#..............##..#.#..###.##..#.###...#......#.#...##..
....#...##.##.#.#.......#...#.#.##.#...#.###..#.#...##...

output:

Yes
236320
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2...

result:

ok AC

Test #49:

score: 0
Accepted
time: 7ms
memory: 4232kb

input:

80
###..####..############.########.########.###.########.#####.###.##.######..####
.#####.#.#####.###.######.###..##.################.###.#.#######################
########.#####.######..##.##.####.#.#####.#.#.###..#########...######.##.#######
##.############.#..#.##..########.####..####..#.######...

output:

Yes
124160
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2...

result:

ok AC

Test #50:

score: 0
Accepted
time: 19ms
memory: 5272kb

input:

80
#.###.##..#..##############.#.###..#######.#####.####.###.######...######.######
#.##...#.####.#.###..#.#####.####.#.#.######.#####.#...###.##..##.#.####.##..###
#####################.#..#####.######.###.####.##############.####.###.##.##.#.#
##.##.#.###.##..#####.###########.##.#.#.#.##..#.###.#...

output:

Yes
207360
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10
2 10...

result:

ok AC

Test #51:

score: 0
Accepted
time: 14ms
memory: 5420kb

input:

80
#####..##.###..###..##.#......#..####.##.####.#####.##.####.###.###..#..#.####..
####...######.#####.##.######..#####..####..#######.#..###########.#..##..#.####
.#..#..##..##..#..#.#.#####..##.#######.##.###..####.###.###..#.#.###.#######.##
.#.###.########..###.#.#.#####.###..##...####..#..###....

output:

Yes
199520
1 1
1 1
1 1
1 1
1 1
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2 6
2...

result:

ok AC

Test #52:

score: 0
Accepted
time: 41ms
memory: 9344kb

input:

80
##.#..#####...####.#.....#.#.#....##...#.....##...##....#..##....###.....#.##.#.
##.#...#..##.#####...#..#.......#..#..#.###.###########.###.#.##.##.##.########.
...##.##.#..###...###.#.###.#.##.#####..#.....##.####..##.#.####.#######.###.###
....#.##..#.##...##..##.##....#.#...###.#.##..##.##......

output:

Yes
512000
1 1
1 1
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2...

result:

ok AC

Test #53:

score: 0
Accepted
time: 45ms
memory: 8760kb

input:

80
.#..#.####..##.#..##...#.#..#.#.#...#.#####.#..##....#.####.#.####.##.#.#...#..#
.#.#...#....#.##.###..#.###..#.#.#.#...####.#..#..##...####..##..##..#.##.#..###
...##.#..###...#....#..###..#.#..##.#.#..#.##.####....###..#.######....#.#..####
...##..##...#.#...##...##.#.####.#...###..#...#####.##...

output:

Yes
512000
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1...

result:

ok AC

Test #54:

score: 0
Accepted
time: 46ms
memory: 8948kb

input:

80
####...####.#.#..####.....###...#.#.#......#..##.###.###.#.#.#...#..###.#...#..#
#...#.#..#.###.#.#.####..###..#.#...#.##.#...##.#..##..#..##.#.####.#..##..##.#.
#.########.###...#..##..##..######..#.#.#.###..##..#.#.#.###.#.###...#.####..###
#.##.#.####..####.#..##.###.##.##......#..##....###.##...

output:

Yes
512000
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2 5
2...

result:

ok AC

Test #55:

score: 0
Accepted
time: 41ms
memory: 8148kb

input:

80
#..#..........###.#...#.######..###...###..####.#..#.####.##.###..##....#..#.##.
###..##.#.#.###......#####...#.##.#.#..#.....###.#...##.#.##.#......#.#..###...#
####.##...#.###..###.####..#.#.###.####..#.##.###.#.#..##.##.##....##...#.#...##
##.#.#..#.###....##..####.#......#####....##.#.##.#.##...

output:

Yes
512000
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2...

result:

ok AC

Test #56:

score: 0
Accepted
time: 45ms
memory: 9428kb

input:

80
.#..#...#...##...#....##.#.#.###....##.#.#..#.#.#......#####.#.##.#.#...#.###...
#..######.##.####..####..##..#####.##.....#.##...###.##.##.#....#.######....###.
#.#.#.##..##.#..#...##...###.#....#.######.#####....#.#..#.####..#....##..#...##
#.#####.##.#.....#.##.###.#####.#########.####.##....#...

output:

Yes
512000
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2...

result:

ok AC

Test #57:

score: 0
Accepted
time: 45ms
memory: 7960kb

input:

80
#.#.#....#.#.#......##.##..#.##...##.##..#######..#####..##.#....####.##.##.##..
...####...#.###...#.#........#.##....#...##..##...#.#########..#.#...##....#.#..
..#..#.###..#.#..###.##.###..##..####.#..##.#.##..#...#...##.....###.#....###.#.
##.######..#...###.##.####.#.#..##.#.##....#..#..#...#...

output:

Yes
512000
1 1
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2...

result:

ok AC

Test #58:

score: 0
Accepted
time: 45ms
memory: 9004kb

input:

80
...###.#.#..#....##.##....#.####.####..########.##..#####.##.#..##..##.#...#.#.#
#.#.....#.##...#.##..#..#...#..###.###.########.##....#..##..#.#.#.#.##.........
#..##...#.##.#.#.##...##.......###...##..#...##..####.####.##.##..#.##....#####.
#.##..##..#.#.#..#..##.#...##.##.#.....#....#.#.##..#....

output:

Yes
512000
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2 1
2...

result:

ok AC

Test #59:

score: 0
Accepted
time: 38ms
memory: 8548kb

input:

80
###..#.#..#.#.#.#.##.####..##.##......###.##..##.#.#....####....###.#....###.#.#
#######.#.##...##.....####.##...###..#.#..###..###.#..###.#.......#....#.#.#....
###.#.#.##...#...##.....###.##.#...#..###.#...###.##.#.##..#.#..#.#....######..#
#.#..##.#.######.#...##.#..#...#.#..#..#...#..##.#...#...

output:

Yes
512000
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2 4
2...

result:

ok AC

Test #60:

score: 0
Accepted
time: 41ms
memory: 7888kb

input:

80
##.##..##....#..#.#...#####....#.####....#.....#..####...#.##.#..#..#######..##.
.######.####..#.#####.##.....#.####....#.###.....##.#.#.#....#.##.#.#.###.##....
###.#..#.##.#.##.##.#.#.##.....##..#...#...#.#.##.#####.#....#..#..#.###.#.#.#.#
#..#..##..#.##..#..#.###.#.###..#...####.##....####......

output:

Yes
512000
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2...

result:

ok AC

Test #61:

score: 0
Accepted
time: 41ms
memory: 9336kb

input:

80
.#.##..####..#.#..#.##.##.##..#..#############..###.######.#.#..##.##....##.##.#
....#...##.#.####..#.##..#....#...#.#..##..##.###.######.###..#.#.####.#......#.
....##...###.#.#..#.#....#...#.#####..###.#.##...###.......#.####.####....#..##.
..###.#....##..#.#..#.#.##..###..#.##..##..#.####.#.##...

output:

Yes
512000
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1...

result:

ok AC

Test #62:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

5
...##
##...
#.#.#
#.#.#
#.#..
###..
..###
.#...
.#.#.
.#.##

output:

Yes
120
2 1
2 1
2 1
2 1
1 1
1 1
2 1
1 1
1 1
1 1
2 2
2 2
2 2
2 2
1 1
1 1
2 2
1 1
1 1
1 1
2 3
1 2
1 2
2 3
2 3
2 3
2 3
1 2
1 2
1 2
2 3
2 3
2 3
2 3
1 2
2 3
1 2
1 2
1 2
1 2
2 4
1 3
1 3
1 3
2 4
2 4
2 4
2 4
1 3
1 3
1 3
1 3
2 5
1 3
1 3
1 3
2 5
2 5
2 5
2 5
1 3
1 3
2 2
2 2
2 2
2 2
1 3
1 3
1 3
2 2
1 4
2 2
2 2
...

result:

ok AC

Test #63:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

5
###.#
.#...
#..#.
#..##
.#..#
...#.
#.#.#
.##.#
.##..
#.##.

output:

Yes
120
1 1
1 1
1 1
2 4
2 4
2 4
2 4
1 1
1 1
2 4
2 1
2 1
2 1
2 1
1 1
1 1
1 1
1 1
2 1
1 1
2 3
2 3
2 3
2 3
1 1
1 1
1 1
1 1
2 3
1 1
1 1
1 1
1 1
1 1
2 5
2 5
2 5
2 5
1 1
2 5
2 2
2 2
2 2
2 2
1 2
1 2
1 2
1 2
2 2
1 2
1 3
1 3
2 3
2 3
2 3
2 3
1 3
1 3
1 3
2 3
2 5
2 5
2 5
2 5
1 3
2 5
1 3
1 3
1 3
1 3
2 2
2 2
2 2
...

result:

ok AC

Test #64:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

5
..##.
..#.#
.....
#....
....#
#....
.....
.#...
..#..
.#.##

output:

Yes
50
1 1
1 1
1 1
2 1
2 1
2 1
2 1
1 1
1 1
2 1
2 2
2 2
2 2
1 1
1 1
1 1
2 2
2 2
1 1
1 1
1 2
1 2
1 2
1 2
2 3
2 3
2 3
1 2
2 3
2 3
2 2
2 2
1 2
1 2
2 2
2 2
2 2
1 2
1 2
1 2
2 4
2 4
2 4
2 4
1 4
1 4
1 4
2 4
1 4
1 4

result:

ok AC

Test #65:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

5
.#...
.....
.#.##
.....
.....
.....
.....
..##.
...#.
#....

output:

Yes
30
2 3
2 3
2 3
1 1
2 3
2 3
1 1
1 1
1 1
1 1
1 3
1 3
2 4
2 4
2 4
2 4
1 3
1 3
1 3
2 4
2 1
2 1
2 1
1 3
2 1
2 1
1 3
1 3
1 3
1 3

result:

ok AC

Test #66:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

5
...##
##.#.
.....
#.#.#
#.##.
...#.
.#..#
###.#
#..##
.#...

output:

Yes
70
1 1
1 1
1 1
1 1
2 5
2 5
2 5
2 5
1 1
2 5
2 1
2 1
2 1
2 1
1 2
1 2
1 2
1 2
2 1
1 2
1 2
1 2
1 2
2 2
2 2
2 2
2 2
1 2
1 2
2 2
1 4
1 4
1 4
1 4
2 3
1 4
2 3
2 3
2 3
2 3
2 5
2 5
1 5
1 5
1 5
1 5
2 5
2 5
2 5
1 5
1 5
2 4
1 5
1 5
1 5
1 5
2 4
2 4
2 4
2 4
1 5
1 5
1 5
2 2
2 2
2 2
2 2
1 5
1 5
2 2

result:

ok AC

Test #67:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

5
#.#..
###.#
.##.#
.#...
..#..
#...#
##..#
....#
#..##
.##..

output:

Yes
50
2 5
2 5
2 5
2 5
1 1
1 1
2 5
1 1
1 1
1 1
1 2
1 2
1 2
2 1
2 1
2 1
1 2
1 2
2 1
2 1
2 4
2 4
2 4
2 4
1 3
1 3
2 4
1 3
1 3
1 3
1 3
1 3
2 5
2 5
2 5
2 5
1 3
1 3
1 3
2 5
1 4
1 4
1 4
1 4
2 2
2 2
2 2
2 2
1 4
2 2

result:

ok AC

Test #68:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

6
##....
##.#.#
.###..
#..#.#
.###..
##..#.
..####
..#.#.
#...##
.##.#.
#...##
..##.#

output:

Yes
216
1 1
1 1
2 3
2 3
2 3
2 3
2 3
1 1
1 1
1 1
1 1
2 3
2 4
2 4
2 4
2 4
2 4
1 1
1 1
2 4
1 1
1 1
1 1
1 1
2 5
1 2
1 2
1 2
1 2
2 5
2 5
2 5
2 5
2 5
1 2
1 2
1 2
1 2
1 2
1 2
2 6
1 2
1 2
2 6
2 6
2 6
2 6
2 6
2 3
2 3
2 3
2 3
2 3
1 2
1 2
1 2
1 2
1 2
2 3
1 2
1 2
1 2
1 2
1 2
1 2
2 5
2 5
2 5
2 5
2 5
1 2
2 5
2 1
...

result:

ok AC

Test #69:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

6
.##.##
##....
..#...
.##.#.
.##..#
###.##
#..#..
..####
##.###
#..#.#
#..##.
...#..

output:

Yes
216
2 1
2 1
2 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
2 1
1 1
1 1
2 4
2 4
2 4
2 4
2 4
1 1
1 1
1 1
1 1
1 1
2 4
2 3
2 3
2 3
2 3
2 3
1 1
1 1
1 1
1 1
2 3
1 1
1 1
1 1
1 1
1 1
1 1
2 4
2 4
2 4
2 4
2 4
1 1
1 1
2 4
1 2
1 2
1 2
1 2
2 5
2 5
2 5
2 5
2 5
1 2
1 2
2 5
1 2
1 2
1 2
1 2
2 6
2 6
2 6
2 6
2 6
1 2
1 2
2 6
1 3
...

result:

ok AC

Test #70:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

6
......
......
......
......
......
......
......
......
......
......
......
......

output:

Yes
0

result:

ok AC

Test #71:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

6
###..#
##....
..#..#
#.#.##
.#.#.#
.#.###
##.#..
##..#.
.##.#.
.##...
#.###.
#.###.

output:

Yes
120
1 1
2 4
2 4
2 4
2 4
2 4
1 1
1 1
1 1
1 1
1 1
2 4
2 5
2 5
2 5
2 5
2 5
1 1
1 1
1 1
1 1
1 1
2 5
1 1
1 3
1 3
2 2
2 2
2 2
2 2
2 2
1 3
1 3
1 3
1 3
2 2
1 4
1 4
1 4
1 4
2 5
1 4
1 4
2 5
2 5
2 5
2 5
2 5
2 2
2 2
2 2
2 2
2 2
1 4
1 4
1 4
2 2
1 4
1 4
1 4
2 1
2 1
2 1
2 1
2 1
1 4
2 1
1 4
1 4
1 4
1 4
1 4
1 5
...

result:

ok AC

Test #72:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

6
.#..#.
#.####
...###
##....
#.####
#.#...
.##.#.
.###.#
#.##.#
#.#...
###..#
.##...

output:

Yes
84
1 2
1 2
2 3
1 2
1 2
1 2
1 2
2 3
2 3
2 3
2 3
2 3
1 2
1 2
1 2
2 2
2 2
2 2
2 2
2 2
1 2
1 2
1 2
2 2
2 1
2 1
2 1
2 1
2 1
1 3
1 3
2 1
1 3
1 3
1 3
1 3
2 3
1 4
2 3
2 3
2 3
2 3
2 3
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
2 3
1 5
2 3
2 3
2 3
2 3
2 3
1 5
1 5
1 5
2 2
2 2
2 2
2 2
2 2
1 5
1 5
1 5
2 2
2 2
2...

result:

ok AC

Test #73:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

6
.#####
.##..#
##.##.
......
##..##
....#.
...#..
####..
.###..
###.#.
..##.#
....##

output:

Yes
120
2 1
2 1
2 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
2 1
1 1
1 1
2 4
2 4
2 4
2 4
2 4
1 1
1 1
1 1
1 1
1 1
2 4
2 3
2 3
2 3
2 3
1 1
1 1
1 1
1 1
2 3
2 3
1 1
1 1
2 1
2 1
2 1
1 1
2 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
1 2
1 2
2 2
2 2
2 2
2 2
1 2
1 2
1 2
1 2
2 2
2 2
1 3
1 3
2 3
2 3
2 3
2 3
2 3
1 3
1 3
1 3
1 3
2 3
1 3
...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed