QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#658093#9478. Shift Puzzleucup-team159#AC ✓30ms4184kbC++206.7kb2024-10-19 16:08:502024-10-19 16:08:54

Judging History

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

  • [2024-10-19 16:08:54]
  • 评测
  • 测评结果:AC
  • 用时:30ms
  • 内存:4184kb
  • [2024-10-19 16:08:50]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < (t); ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define pob pop_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define newline puts("")
#define vc vector
using namespace std;
template<class T> using vv = vc<vc<T>>;
template<class T> using PQ = priority_queue<T,vc<T>,greater<T>>;
using uint = unsigned; using ull = unsigned long long;
using vi = vc<int>; using vvi = vv<int>; using vvvi = vv<vi>;
using ll = long long; using vl = vc<ll>; using vvl = vv<ll>; using vvvl = vv<vl>;
using P = pair<int,int>; using vp = vc<P>; using vvp = vv<P>; using LP = pair<ll,ll>;
int geti(){int x;scanf("%d",&x);return x;}
vi pm(int n, int s=0) { vi a(n); iota(rng(a),s); return a;}
template<class T1,class T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<class T1,class T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<class T>istream& operator>>(istream&i,vc<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<class T>string join(const T&v,const string&d=""){stringstream s;rep(i,sz(v))(i?s<<d:s)<<v[i];return s.str();}
template<class T>ostream& operator<<(ostream&o,const vc<T>&v){if(sz(v))o<<join(v," ");return o;}
template<class T>void vin(vc<T>&a){int n;cin>>n;a=vc<T>(n);cin>>a;}
template<class T>void vin(vv<T>&a){int n,m;cin>>n>>m;a=vv<T>(n,vc<T>(m));cin>>a;}
template<class T1,class T2>void operator--(pair<T1,T2>&a,int){a.fi--;a.se--;}
template<class T1,class T2>void operator++(pair<T1,T2>&a,int){a.fi++;a.se++;}
template<class T>void operator--(vc<T>&a,int){for(T&x:a)x--;}
template<class T>void operator++(vc<T>&a,int){for(T&x:a)x++;}
template<class T1,class T2>void operator+=(vc<T1>&a,T2 b){for(T1&x:a)x+=b;}
template<class T1,class T2>void operator-=(vc<T1>&a,T2 b){for(T1&x:a)x-=b;}
template<class T1,class T2>void operator*=(vc<T1>&a,T2 b){for(T1&x:a)x*=b;}
template<class T1,class T2>void operator/=(vc<T1>&a,T2 b){for(T1&x:a)x/=b;}
template<class T>void operator+=(vc<T>&a,const vc<T>&b){a.insert(a.end(),rng(b));}
template<class T1,class T2>pair<T1,T2>operator+(const pair<T1,T2>&a,const pair<T1,T2>&b){return {a.fi+b.fi,a.se+b.se};}
template<class T1,class T2>pair<T1,T2>operator-(const pair<T1,T2>&a,const pair<T1,T2>&b){return {a.fi-b.fi,a.se-b.se};}
template<class T>pair<T,T>operator*(const pair<T,T>&a,T b){return {a.fi*b,a.se*b};}
template<class T1,class T2>bool mins(T1& x,const T2&y){if(y<x){x=y;return true;}else return false;}
template<class T1,class T2>bool maxs(T1& x,const T2&y){if(x<y){x=y;return true;}else return false;}
template<class T>T min(const vc<T>&a){return *min_element(rng(a));}
template<class T>T max(const vc<T>&a){return *max_element(rng(a));}
template<class Tx,class Ty>Tx dup(Tx x, Ty y){return (x+y-1)/y;}
template<class T>ll suma(const vc<T>&a){ll s=0;for(auto&&x:a)s+=x;return s;}
template<class T>ll suma(const vv<T>&a){ll s=0;for(auto&&x:a)s+=suma(x);return s;}
template<class T>void uni(T&a){sort(rng(a));a.erase(unique(rng(a)),a.end());}
template<class T>void prepend(vc<T>&a,const T&x){a.insert(a.begin(),x);}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return;}
#define yes { puts("Yes");}
#define no { puts("No"); return;}
#define rtn(x) { cout<<(x)<<'\n'; return;} // flush!
#define yn {puts("Yes");}else{puts("No");}
using vs = vc<string>;
void vin(vs& s){int n,m;cin>>n>>m;s=vs(n);cin>>s;}
template<typename T>void rot(T& a,int i){rotate(a.begin(),a.begin()+(i),a.end());}
template<typename T>void rot(vv<T>& a){int h=sz(a),w=sz(a[0]);vv<T> p(w,vc<T>(h));swap(a,p);rep(i,h)rep(j,w)a[j][h-1-i]=p[i][j];}
void rot(vc<string>& a){int h=sz(a),w=sz(a[0]);vc<string> p(w,string(h,'?'));swap(a,p);rep(i,h)rep(j,w)a[j][h-1-i]=p[i][j];}


struct Solver {
  int countx(vs& s) {
    int n = sz(s);
    int res = 0;
    rep(i,n)rep(j,n) res += s[i][j] == '#';
    return res;
  }

  vp calc(vs s, bool fli=false) {
    int n = sz(s);
    int m = countx(s);

    int n1 = n-1;
    int up = m/n1, rem = m%n1;
    vp res;

    // cout<<fli<<" "<<up<<" "<<rem<<endl;
    // cout<<s<<endl;

    auto row = [&](int i) {
      if (fli) rot(s[i],1);
      else rot(s[i],n1);
      res.eb(1,i+1);

      // rep(i,n) cout<<s[i]<<endl; cout << endl;
      // cout<<res<<endl;
    };
    auto col = [&](int j) {
      if (fli) {
        rep(i,n1) swap(s[i][j],s[i+1][j]);
      } else {
        drep(i,n1) swap(s[i][j],s[i+1][j]);
      }
      res.eb(2,j+1);

      // rep(i,n) cout<<s[i]<<endl; cout << endl;
      // cout<<res<<endl;
    };

    while (1) {
      rep(i,n) {
        char ca = '.', cb = '#';
        if (i < up) swap(ca,cb);
        rep(j,n1) if (s[i][n1] == ca && s[i][j] == cb) {
          row(i);
        }
      }

      bool ok = true;
      rep(i,n) {
        char c = (i<up)?'#':'.';
        rep(j,n1) if (s[i][j] != c) ok = false;
      }
      if (ok) break;

      col(n1);
    }

    if (rem) {
      if (fli) {
        while (s[up][n1-rem] == '.') {
          while (s[up][n1] == '.') {
            col(n1);
          }
          row(up);
        }
        rep(i,n1-rem) row(up);
      } else {
        while (s[up][rem-1] == '.') {
          while (s[up][n1] == '.') {
            col(n1);
          }
          row(up);
        }
      }
    }

    return res;
  }
  void solve() {
    int n;
    cin>>n;
    vs s(n), t(n);
    cin>>s>>t;

    int m = countx(s);
    if (m != countx(t)) no;

    if (m*2 > n*n) {
      rep(i,n)rep(j,n) s[i][j] ^= '#'^'.';
      rep(i,n)rep(j,n) t[i][j] ^= '#'^'.';
    }

    vp ans = calc(s);
    vp ans2 = calc(t,true);
    reverse(rng(ans2));
    ans.insert(ans.end(), rng(ans2));

    assert(sz(ans) <= n*n*n);
    if (0) {
      for (auto [type,x] : ans) {
        if (type == 1) {
          rot(s[x-1],n-1);
        } else {
          drep(i,n-1) swap(s[i][x-1],s[i+1][x-1]);
        }

        // cerr<<type<<" "<<x<<endl;
        // rep(i,n) cerr<<s[i]<<endl;
      }
      assert(s == t);
      yes;
      return;
    }

    yes;
    printf("%d\n",sz(ans));
    for (auto& p: ans) {
      printf("%d %d\n",p.fi,p.se);
    }
  }
};

int main() {
  // cin.tie(nullptr); ios::sync_with_stdio(false);
  int ts = 1;
  // scanf("%d",&ts);
  rep1(ti,ts) {
    Solver solver;
    solver.solve();
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

Yes
14
1 2
1 3
2 3
1 1
1 1
1 1
2 3
2 3
1 3
1 2
2 3
1 2
2 3
1 1

result:

ok AC

Test #2:

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

input:

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

output:

Yes
12
1 2
1 3
2 3
1 1
1 1
1 2
2 3
1 3
1 1
2 3
1 3
1 2

result:

ok AC

Test #3:

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

input:

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

output:

No

result:

ok AC

Test #4:

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

input:

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

output:

No

result:

ok AC

Test #5:

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

input:

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

output:

No

result:

ok AC

Test #6:

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

input:

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

output:

No

result:

ok AC

Test #7:

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

input:

2
..
..
..
..

output:

Yes
0

result:

ok AC

Test #8:

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

input:

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

output:

Yes
13
1 2
2 3
1 1
1 3
1 3
2 3
2 3
1 2
1 1
2 3
2 3
1 3
1 1

result:

ok AC

Test #9:

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

input:

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

output:

Yes
12
1 2
1 2
2 3
1 1
2 3
1 1
1 1
2 3
1 1
2 3
1 3
1 2

result:

ok AC

Test #10:

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

input:

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

output:

Yes
11
1 2
1 2
1 2
1 2
1 2
2 3
1 3
1 1
2 3
1 3
1 2

result:

ok AC

Test #11:

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

input:

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

output:

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

result:

ok AC

Test #12:

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

input:

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

output:

Yes
27
2 4
1 1
1 1
1 4
1 4
1 4
2 4
2 4
1 2
1 1
2 4
1 1
2 4
1 3
2 4
1 1
2 4
1 4
1 3
2 4
1 4
1 2
2 4
1 4
1 2
2 4
1 2

result:

ok AC

Test #13:

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

input:

2
.#
.#
#.
#.

output:

Yes
2
1 1
1 2

result:

ok AC

Test #14:

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

input:

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

output:

Yes
12
1 2
1 2
1 1
2 3
2 3
1 3
1 2
1 1
2 3
1 3
1 2
2 3

result:

ok AC

Test #15:

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

input:

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

output:

Yes
12
1 3
2 3
1 1
1 1
1 1
2 3
2 3
1 2
2 3
1 3
1 2
1 1

result:

ok AC

Test #16:

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

input:

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

output:

Yes
13
1 1
1 3
1 3
2 3
2 3
1 2
1 1
2 3
2 3
1 3
2 3
1 3
1 2

result:

ok AC

Test #17:

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

input:

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

output:

Yes
31
1 2
1 4
1 4
2 4
1 2
2 4
2 4
1 3
2 4
1 3
1 3
1 3
2 4
2 4
2 4
1 3
1 3
1 1
2 4
1 1
2 4
1 4
1 3
1 1
2 4
1 4
2 4
1 4
1 2
2 4
1 3

result:

ok AC

Test #18:

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

input:

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

output:

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

result:

ok AC

Test #19:

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

input:

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

output:

No

result:

ok AC

Test #20:

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

input:

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

output:

No

result:

ok AC

Test #21:

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

input:

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

output:

No

result:

ok AC

Test #22:

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

input:

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

output:

Yes
2641
1 3
1 7
1 7
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 8
1 9
1 9
1 11
1 11
1 12
1 12
1 12
1 14
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 16
1 16
1 16
1 17
1 17
1 18
1 19
1 19
1 19
1 19
1 19
1 20
1 20
1 21
1 21
1 21
1 22
1 22
1 22
1 22
1 ...

result:

ok AC

Test #23:

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

input:

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

output:

Yes
1151
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 3
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7...

result:

ok AC

Test #24:

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

input:

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

output:

Yes
1219
1 8
1 9
1 9
1 9
1 10
1 11
1 12
1 13
1 15
1 17
1 17
1 19
1 19
1 19
1 19
1 19
1 20
1 22
1 22
1 22
1 23
1 23
1 23
1 23
2 23
1 1
1 8
1 8
2 23
1 1
1 8
2 23
1 1
1 8
1 8
1 8
1 8
2 23
1 1
1 8
1 8
1 8
2 23
1 1
1 8
2 23
1 1
1 8
2 23
1 1
1 8
1 8
1 8
1 8
1 8
2 23
1 1
1 8
1 8
2 23
1 1
1 1
2 23
1 1
1 1
1...

result:

ok AC

Test #25:

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

input:

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

output:

Yes
919
1 1
1 2
1 6
1 7
1 7
1 7
1 7
1 8
1 8
1 8
1 8
1 8
1 9
1 9
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 11
1 11
1 11
1 11
1 11
1 11
1 12
1 12
1 12
1 12
1 12
1 12
1 12
1 12
1 12
1 13
1 14
1 15
1 16
1 16
1 17
1 18
1 19
1 19
1 19
1 19
1 19
1 19
1 19
1 19
1 20
1 20
1 20
2 20
1 1
1 6
1 6
1 6
1 6
1 6
1 ...

result:

ok AC

Test #26:

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

input:

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

output:

Yes
344
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
1 4
1 6
1 7
1 7
1 7
1 7
1 8
1 8
1 8
1 8
1 8
1 11
1 11
1 11
1 11
1 11
2 12
1 1
1 1
1 1
1 6
2 12
1 1
1 6
2 12
1 6
1 6
2 12
1 2
1 2
1 6
1 6
1 6
1 6
2 12
1 2
2 12
1 2
1 7
2 12
1 2
1 2
1 7
1 7
1 7
1 7
2 12
1 2
1 7
2 12
1 2
1 2
2 12
1 8
1 8
1 8
1 8
1 8
2 12
1 3
1 8
...

result:

ok AC

Test #27:

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

input:

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

output:

Yes
4800
1 1
1 1
1 4
1 4
1 4
1 5
1 5
1 5
1 6
1 6
1 9
1 9
1 11
1 14
1 15
1 16
1 17
1 19
1 20
1 20
1 23
1 23
1 23
1 24
1 24
1 25
1 27
1 27
1 27
1 31
1 31
1 33
1 34
1 35
1 38
1 41
1 42
1 42
1 42
1 42
2 44
1 1
1 23
1 23
2 44
1 1
1 23
1 23
1 23
2 44
1 1
1 23
2 44
1 1
1 1
1 1
1 23
2 44
1 1
1 1
1 1
1 1
1 1...

result:

ok AC

Test #28:

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

input:

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

output:

Yes
241
1 1
1 2
1 2
1 2
1 4
1 7
1 7
1 7
1 9
2 10
1 1
1 1
1 6
1 6
2 10
1 1
1 1
1 6
2 10
1 1
1 6
1 6
1 6
2 10
1 1
1 6
1 6
2 10
2 10
1 2
1 7
1 7
2 10
1 2
1 7
2 10
1 2
1 7
1 7
2 10
1 7
2 10
1 3
2 10
1 3
1 8
1 8
2 10
1 3
1 3
1 8
2 10
1 8
1 8
1 8
2 10
1 4
1 8
1 8
1 8
2 10
1 4
2 10
1 4
1 9
1 9
2 10
1 4
1 4...

result:

ok AC

Test #29:

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

input:

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

output:

Yes
4808
1 2
1 2
1 2
1 2
1 2
1 3
1 6
1 6
1 6
1 7
1 7
1 8
1 9
1 9
1 10
1 13
1 14
1 14
1 15
1 15
1 16
1 21
1 23
1 24
1 25
1 25
1 25
1 25
1 25
1 27
1 29
1 29
1 30
1 30
1 32
1 32
1 33
1 37
1 37
1 37
1 37
1 39
1 41
1 42
1 42
1 43
1 44
2 44
1 1
1 23
1 23
2 44
1 1
1 23
2 44
1 1
1 23
2 44
1 1
1 1
1 23
1 23
...

result:

ok AC

Test #30:

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

input:

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

output:

Yes
236
1 1
1 2
1 3
1 5
1 6
1 7
1 7
1 7
1 8
1 8
1 9
1 9
1 9
1 9
2 10
1 1
1 6
2 10
1 1
1 6
1 6
2 10
1 1
1 1
1 6
2 10
1 1
1 6
1 6
2 10
1 6
2 10
1 2
2 10
1 2
1 2
1 2
1 7
2 10
1 2
1 2
1 2
1 7
1 7
1 7
2 10
1 7
2 10
1 3
1 3
1 3
2 10
1 3
1 8
2 10
1 3
1 3
1 8
1 8
2 10
1 3
1 8
2 10
1 8
2 10
1 4
1 8
1 8
2 10
...

result:

ok AC

Test #31:

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

input:

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

output:

Yes
2225
1 2
1 2
1 4
1 6
1 6
1 7
1 8
1 9
1 13
1 13
1 14
1 14
1 15
1 16
1 16
1 16
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 27
1 27
1 27
1 27
1 27
1 27
1 28
1 29
1 30
1 30
1 30
2 30
1 1
1 16
2 30
1 1
1 1
1 16
1 16
2 30
1 1
1 1
1 1
1 16
2 30
1 1
1 16
2 30
1 1
1 16
1 16
1 16
2 30
1 1
1 1
1 1
1 1
1 16
1 16
1...

result:

ok AC

Test #32:

score: 0
Accepted
time: 12ms
memory: 3868kb

input:

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

output:

Yes
13198
1 1
1 3
1 11
1 11
1 11
1 11
1 12
1 12
1 13
1 13
1 14
1 14
1 14
1 14
1 14
1 14
1 14
1 14
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 16
1 16
1 16
1 16
1 16
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 18
1 18
1 19
1 19
1 20
1 20
1 20
1 ...

result:

ok AC

Test #33:

score: 0
Accepted
time: 13ms
memory: 4080kb

input:

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

output:

Yes
13620
1 7
1 9
1 13
1 13
1 14
1 14
1 14
1 14
1 14
1 14
1 17
1 17
1 18
1 18
1 18
1 18
1 19
1 21
1 21
1 21
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 23
1 24
1 24
1 24
1 24
1 26
1 26
1 27
1 27
1 27
1 28
1 28
1 28
1 28
1 28
1 28
1 29
1 29
1 29
1 29
1 29
1 29
1 29
1 30
1 ...

result:

ok AC

Test #34:

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

input:

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

output:

Yes
12767
1 3
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 11
1 11
1 11
1 11
1 12
1 12
1 12
1 12
1 12
1 12
1 12
1 13
1 13
1 13
1 13
1 13
1 13
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 16
1 16
1 16
1 16
1 16
1 16
1 18
1 18
1 18
1 18
1 18
1 19
1 19
1 19
1 19
1 20
1 21
1 21
1...

result:

ok AC

Test #35:

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

input:

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

output:

Yes
9603
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 5
1 6
1 6
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7
1 7...

result:

ok AC

Test #36:

score: 0
Accepted
time: 20ms
memory: 3936kb

input:

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

output:

Yes
15260
1 6
1 7
1 11
1 14
1 17
1 22
1 23
1 24
1 28
1 29
1 31
1 31
1 31
1 32
1 32
1 32
1 32
1 32
1 33
1 33
1 33
1 35
1 35
1 37
1 37
1 39
1 39
1 40
1 43
1 43
1 43
1 43
1 43
1 43
1 50
1 53
1 53
1 54
1 54
1 54
1 54
1 54
1 55
1 56
1 57
1 57
1 57
1 57
1 57
1 57
1 57
1 58
1 59
1 59
1 59
1 59
1 59
1 62
1 ...

result:

ok AC

Test #37:

score: 0
Accepted
time: 24ms
memory: 4092kb

input:

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

output:

Yes
15389
1 4
1 4
1 6
1 6
1 6
1 7
1 8
1 10
1 10
1 10
1 10
1 12
1 13
1 15
1 17
1 17
1 18
1 19
1 21
1 21
1 21
1 21
1 22
1 22
1 22
1 22
1 22
1 23
1 23
1 23
1 23
1 23
1 23
1 27
1 27
1 27
1 28
1 28
1 29
1 31
1 31
1 31
1 32
1 32
1 33
1 33
1 34
1 34
1 43
1 44
1 44
1 47
1 47
1 48
1 50
1 51
1 51
1 53
1 55
1 ...

result:

ok AC

Test #38:

score: 0
Accepted
time: 30ms
memory: 3744kb

input:

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

output:

Yes
15339
1 1
1 1
1 1
1 1
1 4
1 4
1 5
1 7
1 7
1 8
1 8
1 11
1 11
1 12
1 12
1 14
1 16
1 17
1 19
1 19
1 21
1 23
1 28
1 29
1 29
1 29
1 29
1 30
1 34
1 35
1 35
1 36
1 36
1 37
1 39
1 42
1 45
1 46
1 47
1 47
1 48
1 48
1 49
1 49
1 49
1 50
1 51
1 53
1 55
1 55
1 55
1 55
1 56
1 56
1 57
1 59
1 60
1 60
1 66
1 69
1...

result:

ok AC

Test #39:

score: 0
Accepted
time: 20ms
memory: 4064kb

input:

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

output:

Yes
15426
1 2
1 2
1 3
1 6
1 6
1 7
1 7
1 8
1 11
1 14
1 14
1 15
1 15
1 16
1 16
1 16
1 17
1 19
1 19
1 25
1 25
1 27
1 28
1 29
1 30
1 30
1 30
1 30
1 30
1 31
1 32
1 35
1 35
1 36
1 37
1 38
1 39
1 41
1 42
1 43
1 48
1 51
1 51
1 51
1 51
1 51
1 56
1 56
1 57
1 59
1 63
1 63
1 64
1 66
1 66
1 66
1 66
1 66
1 66
1 6...

result:

ok AC

Test #40:

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

input:

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

output:

Yes
15482
1 5
1 5
1 5
1 6
1 6
1 6
1 6
1 7
1 7
1 11
1 11
1 12
1 12
1 12
1 12
1 12
1 13
1 13
1 16
1 17
1 17
1 17
1 17
1 18
1 19
1 20
1 21
1 22
1 22
1 22
1 22
1 22
1 22
1 28
1 29
1 29
1 29
1 30
1 31
1 31
1 31
1 34
1 38
1 38
1 43
1 45
1 45
1 45
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 47
1 47
1 48
1 49
1 50...

result:

ok AC

Test #41:

score: 0
Accepted
time: 27ms
memory: 4088kb

input:

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

output:

Yes
15473
1 2
1 3
1 3
1 3
1 8
1 9
1 9
1 9
1 12
1 12
1 12
1 13
1 13
1 15
1 16
1 18
1 25
1 26
1 28
1 29
1 29
1 29
1 31
1 31
1 35
1 36
1 38
1 38
1 38
1 40
1 40
1 43
1 45
1 45
1 45
1 45
1 46
1 49
1 49
1 49
1 51
1 55
1 59
1 59
1 59
1 59
1 59
1 59
1 59
1 59
1 60
1 62
1 62
1 64
1 64
1 65
1 66
1 72
1 73
1 7...

result:

ok AC

Test #42:

score: 0
Accepted
time: 26ms
memory: 3924kb

input:

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

output:

Yes
15612
1 1
1 2
1 2
1 2
1 5
1 9
1 9
1 10
1 13
1 15
1 15
1 16
1 17
1 20
1 22
1 22
1 25
1 26
1 28
1 28
1 28
1 28
1 29
1 29
1 29
1 30
1 31
1 31
1 32
1 33
1 34
1 37
1 38
1 38
1 39
1 39
1 39
1 40
1 41
1 41
1 42
1 43
1 45
1 47
1 47
1 48
1 48
1 48
1 48
1 49
1 49
1 49
1 49
1 49
1 51
1 51
1 51
1 51
1 52
1 ...

result:

ok AC

Test #43:

score: 0
Accepted
time: 24ms
memory: 4100kb

input:

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

output:

Yes
16042
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 3
1 3
1 3
1 4
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 8
1 8
1 8
1 8
1 9
1 9
1 9
1 10
1 15
1 15
1 15
1 15
1 16
1 16
1 17
1 17
1 18
1 18
1 18
1 19
1 19
1 21
1 21
1 25
1 25
1 25
1 27
1 27
1 27
1 27
1 29
1 29
1 29
1 30
1 30
1 30
1 30
1 31
1 31
1 33
1 35
1 39
1 39
1 39
1 40
...

result:

ok AC

Test #44:

score: 0
Accepted
time: 25ms
memory: 4092kb

input:

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

output:

Yes
15571
1 1
1 1
1 3
1 3
1 3
1 3
1 3
1 7
1 8
1 8
1 8
1 9
1 9
1 9
1 10
1 10
1 10
1 11
1 14
1 15
1 18
1 18
1 18
1 18
1 18
1 19
1 20
1 22
1 22
1 24
1 24
1 30
1 31
1 31
1 31
1 31
1 32
1 34
1 34
1 39
1 40
1 42
1 43
1 43
1 43
1 43
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 49
1 53
1 54
1 55
1 57
1 57
1 58
1 58...

result:

ok AC

Test #45:

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

input:

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

output:

Yes
15554
1 1
1 1
1 3
1 5
1 6
1 11
1 12
1 14
1 15
1 18
1 18
1 18
1 18
1 18
1 18
1 18
1 19
1 19
1 19
1 19
1 19
1 19
1 19
1 20
1 21
1 21
1 21
1 22
1 22
1 22
1 22
1 23
1 24
1 24
1 27
1 27
1 31
1 32
1 32
1 32
1 34
1 34
1 35
1 36
1 40
1 40
1 41
1 42
1 43
1 46
1 46
1 46
1 47
1 47
1 49
1 50
1 51
1 51
1 52
...

result:

ok AC

Test #46:

score: 0
Accepted
time: 25ms
memory: 4096kb

input:

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

output:

Yes
15480
1 1
1 2
1 4
1 5
1 6
1 6
1 7
1 7
1 7
1 7
1 9
1 12
1 12
1 15
1 24
1 28
1 30
1 30
1 30
1 31
1 31
1 31
1 32
1 32
1 34
1 34
1 35
1 36
1 36
1 39
1 41
1 43
1 44
1 44
1 44
1 44
1 46
1 47
1 52
1 55
1 55
1 55
1 56
1 56
1 56
1 57
1 58
1 58
1 60
1 60
1 63
1 64
1 64
1 64
1 65
1 66
1 66
1 73
1 74
1 75
1...

result:

ok AC

Test #47:

score: 0
Accepted
time: 23ms
memory: 3924kb

input:

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

output:

Yes
15877
1 1
1 1
1 2
1 2
1 4
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 7
1 15
1 18
1 21
1 22
1 23
1 25
1 25
1 25
1 25
1 25
1 27
1 29
1 29
1 31
1 31
1 31
1 31
1 33
1 34
1 36
1 36
1 36
1 36
1 36
1 40
1 40
1 40
1 43
1 46
1 47
1 49
1 49
1 50
1 52
1 52
1 53
1 53
1 55
1 55
1 55
1 55
1 56
1 58
1 58
1 58
1 58
1 62
1 6...

result:

ok AC

Test #48:

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

input:

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

output:

Yes
15786
1 1
1 1
1 9
1 10
1 10
1 10
1 14
1 19
1 19
1 21
1 21
1 26
1 30
1 30
1 30
1 30
1 30
1 30
1 31
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 32
1 35
1 37
1 40
1 41
1 42
1 43
1 45
1 46
1 46
1 47
1 48
1 49
1 49
1 49
1 52
1 52
1 54
1 54
1 54
1 55
1 55
1 55
1 55
1 55
1 55
1 5...

result:

ok AC

Test #49:

score: 0
Accepted
time: 12ms
memory: 3852kb

input:

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

output:

Yes
13735
1 7
1 11
1 12
1 12
1 12
1 12
1 12
1 12
1 12
1 12
1 13
1 13
1 13
1 14
1 14
1 14
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 15
1 16
1 16
1 16
1 16
1 16
1 16
1 16
1 16
1 16
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1...

result:

ok AC

Test #50:

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

input:

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

output:

Yes
15129
1 4
1 4
1 6
1 11
1 14
1 19
1 24
1 25
1 25
1 25
1 25
1 25
1 25
1 25
1 25
1 25
1 25
1 25
1 26
1 27
1 27
1 28
1 30
1 30
1 30
1 30
1 30
1 30
1 30
1 30
1 30
1 32
1 32
1 32
1 33
1 33
1 34
1 34
1 34
1 34
1 35
1 35
1 36
1 36
1 38
1 38
1 38
1 38
1 38
1 38
1 39
1 39
1 39
1 39
1 39
1 40
1 40
1 41
1 4...

result:

ok AC

Test #51:

score: 0
Accepted
time: 15ms
memory: 3864kb

input:

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

output:

Yes
14995
1 1
1 1
1 8
1 11
1 11
1 13
1 15
1 18
1 23
1 26
1 26
1 26
1 26
1 26
1 27
1 27
1 28
1 29
1 29
1 29
1 30
1 31
1 31
1 37
1 37
1 37
1 38
1 38
1 38
1 38
1 38
1 38
1 39
1 40
1 40
1 40
1 40
1 40
1 40
1 42
1 42
1 44
1 44
1 45
1 46
1 46
1 47
1 48
1 49
1 49
1 49
1 49
1 49
1 49
1 51
1 52
1 52
1 52
1 5...

result:

ok AC

Test #52:

score: 0
Accepted
time: 23ms
memory: 3928kb

input:

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

output:

Yes
15903
1 3
1 3
1 3
1 4
1 4
1 7
1 8
1 9
1 9
1 12
1 12
1 13
1 13
1 13
1 15
1 21
1 22
1 23
1 23
1 24
1 24
1 26
1 26
1 27
1 27
1 27
1 28
1 29
1 29
1 29
1 29
1 32
1 34
1 34
1 36
1 38
1 40
1 42
1 42
1 42
1 43
1 43
1 44
1 44
1 45
1 46
1 48
1 48
1 48
1 48
1 49
1 49
1 49
1 50
1 50
1 50
1 50
1 50
1 52
1 53...

result:

ok AC

Test #53:

score: 0
Accepted
time: 22ms
memory: 3924kb

input:

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

output:

Yes
15926
1 1
1 2
1 2
1 2
1 3
1 3
1 3
1 3
1 6
1 6
1 7
1 7
1 10
1 11
1 11
1 11
1 12
1 17
1 18
1 18
1 18
1 19
1 19
1 19
1 20
1 24
1 25
1 26
1 26
1 26
1 26
1 29
1 30
1 31
1 31
1 31
1 31
1 32
1 33
1 33
1 35
1 36
1 36
1 37
1 41
1 41
1 41
1 41
1 41
1 42
1 42
1 42
1 42
1 44
1 44
1 45
1 45
1 45
1 45
1 46
1 ...

result:

ok AC

Test #54:

score: 0
Accepted
time: 23ms
memory: 3876kb

input:

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

output:

Yes
15892
1 1
1 3
1 3
1 3
1 4
1 7
1 7
1 7
1 11
1 11
1 11
1 12
1 12
1 14
1 17
1 18
1 19
1 24
1 26
1 29
1 31
1 32
1 34
1 35
1 40
1 47
1 47
1 48
1 48
1 50
1 51
1 51
1 51
1 51
1 56
1 56
1 58
1 58
1 58
1 58
1 58
1 58
1 58
1 58
1 58
1 61
1 63
1 68
1 68
1 69
1 69
1 69
1 69
1 69
1 70
1 71
1 76
1 78
1 78
1 7...

result:

ok AC

Test #55:

score: 0
Accepted
time: 23ms
memory: 3880kb

input:

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

output:

Yes
15910
1 2
1 3
1 3
1 4
1 5
1 5
1 5
1 5
1 5
1 5
1 7
1 7
1 7
1 7
1 7
1 9
1 9
1 9
1 11
1 13
1 13
1 13
1 14
1 15
1 16
1 17
1 17
1 17
1 17
1 18
1 18
1 18
1 18
1 18
1 18
1 18
1 19
1 19
1 19
1 21
1 22
1 22
1 22
1 22
1 23
1 23
1 24
1 26
1 27
1 27
1 27
1 27
1 28
1 28
1 28
1 28
1 28
1 28
1 30
1 32
1 32
1 3...

result:

ok AC

Test #56:

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

input:

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

output:

Yes
15954
1 3
1 3
1 7
1 7
1 7
1 9
1 9
1 10
1 10
1 12
1 13
1 13
1 17
1 17
1 17
1 17
1 17
1 17
1 17
1 21
1 21
1 22
1 22
1 24
1 25
1 25
1 25
1 25
1 32
1 33
1 33
1 33
1 34
1 36
1 36
1 37
1 37
1 41
1 43
1 45
1 50
1 51
1 51
1 51
1 51
1 51
1 52
1 53
1 53
1 56
1 56
1 56
1 56
1 59
1 61
1 61
1 67
1 67
1 70
1 ...

result:

ok AC

Test #57:

score: 0
Accepted
time: 23ms
memory: 3876kb

input:

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

output:

Yes
15927
1 10
1 11
1 12
1 12
1 12
1 16
1 16
1 17
1 20
1 20
1 21
1 21
1 24
1 27
1 28
1 29
1 29
1 31
1 32
1 32
1 37
1 37
1 38
1 39
1 40
1 40
1 42
1 42
1 42
1 43
1 45
1 47
1 48
1 48
1 48
1 48
1 50
1 53
1 53
1 55
1 57
1 57
1 59
1 59
1 59
1 62
1 63
1 65
1 66
1 66
1 66
1 66
1 70
1 71
1 71
1 71
1 71
1 72
...

result:

ok AC

Test #58:

score: 0
Accepted
time: 18ms
memory: 4096kb

input:

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

output:

Yes
15874
1 1
1 4
1 6
1 11
1 11
1 12
1 12
1 12
1 14
1 15
1 18
1 18
1 18
1 19
1 21
1 21
1 22
1 24
1 24
1 26
1 26
1 28
1 29
1 30
1 31
1 32
1 32
1 33
1 33
1 34
1 37
1 37
1 37
1 38
1 40
1 43
1 47
1 47
1 49
1 50
1 50
1 51
1 51
1 51
1 53
1 53
1 53
1 53
1 53
1 53
1 53
1 53
1 53
1 54
1 54
1 55
1 55
1 55
1 5...

result:

ok AC

Test #59:

score: 0
Accepted
time: 22ms
memory: 3864kb

input:

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

output:

Yes
15900
1 1
1 3
1 5
1 7
1 7
1 10
1 11
1 14
1 15
1 15
1 15
1 15
1 15
1 18
1 19
1 19
1 20
1 20
1 21
1 23
1 23
1 23
1 25
1 25
1 26
1 30
1 30
1 31
1 31
1 31
1 31
1 31
1 32
1 36
1 36
1 36
1 36
1 36
1 37
1 37
1 41
1 42
1 42
1 45
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 46
1 48
1 50
1 56
1 59
...

result:

ok AC

Test #60:

score: 0
Accepted
time: 22ms
memory: 3868kb

input:

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

output:

Yes
15942
1 3
1 4
1 4
1 5
1 5
1 7
1 7
1 9
1 9
1 15
1 19
1 27
1 29
1 29
1 31
1 32
1 33
1 33
1 33
1 33
1 34
1 37
1 37
1 38
1 38
1 38
1 38
1 39
1 40
1 40
1 40
1 41
1 41
1 42
1 42
1 42
1 43
1 43
1 43
1 46
1 46
1 47
1 52
1 53
1 54
1 55
1 55
1 56
1 57
1 59
1 61
1 63
1 65
1 68
1 69
1 69
1 71
1 71
1 73
1 73...

result:

ok AC

Test #61:

score: 0
Accepted
time: 23ms
memory: 4184kb

input:

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

output:

Yes
15888
1 1
1 4
1 5
1 6
1 6
1 12
1 12
1 13
1 15
1 17
1 17
1 17
1 18
1 18
1 18
1 21
1 22
1 22
1 23
1 23
1 23
1 24
1 24
1 25
1 27
1 27
1 27
1 27
1 27
1 28
1 29
1 35
1 35
1 40
1 40
1 40
1 40
1 41
1 43
1 44
1 45
1 45
1 48
1 50
1 50
1 50
1 50
1 54
1 54
1 54
1 54
1 54
1 56
1 58
1 59
1 59
1 60
1 60
1 61
...

result:

ok AC

Test #62:

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

input:

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

output:

Yes
65
1 1
1 1
1 3
1 5
1 5
2 5
1 1
1 4
1 4
2 5
1 1
1 4
1 4
2 5
2 5
1 2
1 5
1 5
2 5
1 2
2 5
2 5
1 3
1 3
1 1
2 5
2 5
2 5
2 5
2 5
1 1
2 5
2 5
2 5
2 5
2 5
1 1
2 5
2 5
2 5
2 5
2 5
1 1
2 5
2 5
2 5
1 4
1 3
2 5
2 5
1 5
1 4
1 3
1 2
2 5
1 5
1 3
2 5
1 5
1 5
1 3
2 5
1 4
1 4
1 2

result:

ok AC

Test #63:

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

input:

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

output:

Yes
48
1 1
2 5
1 4
2 5
1 2
1 4
1 4
1 4
2 5
1 2
2 5
1 2
1 2
1 5
1 5
1 5
2 5
2 5
1 3
1 3
2 5
1 3
1 1
2 5
1 1
2 5
2 5
1 4
2 5
1 3
1 2
1 1
2 5
1 5
1 3
1 2
2 5
1 5
1 4
1 3
2 5
1 5
2 5
1 5
1 4
1 3
1 2
1 2

result:

ok AC

Test #64:

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

input:

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

output:

Yes
42
1 4
1 4
1 4
1 4
2 5
1 1
1 1
1 1
1 2
1 2
2 5
1 1
2 5
2 5
2 5
1 2
2 5
1 2
1 2
1 2
1 2
2 5
1 2
2 5
1 4
1 1
2 5
1 1
2 5
1 5
1 4
1 1
1 1
2 5
1 5
2 5
1 5
1 5
1 3
2 5
1 4
1 3

result:

ok AC

Test #65:

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

input:

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

output:

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

result:

ok AC

Test #66:

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

input:

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

output:

Yes
56
1 1
1 1
1 5
2 5
1 1
1 4
1 4
2 5
1 1
1 4
1 4
2 5
2 5
1 2
1 2
1 5
2 5
1 5
1 5
2 5
1 3
2 5
1 3
2 5
1 3
1 3
1 3
2 5
1 3
2 5
2 5
2 5
1 3
1 3
2 5
1 1
2 5
1 4
1 3
1 1
2 5
1 4
1 3
2 5
1 4
1 2
2 5
1 2
1 1
2 5
1 5
1 4
1 2
2 5
1 5
1 2

result:

ok AC

Test #67:

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

input:

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

output:

Yes
49
1 2
1 4
1 4
1 4
1 5
1 5
2 5
1 1
1 3
1 3
2 5
1 1
1 1
1 3
1 3
2 5
2 5
2 5
1 3
2 5
1 3
1 3
1 3
2 5
1 3
2 5
1 3
2 5
1 4
2 5
1 4
2 5
1 4
2 5
1 2
2 5
1 5
1 2
1 1
2 5
1 5
1 4
1 2
1 1
2 5
1 5
1 2
1 1
1 1

result:

ok AC

Test #68:

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

input:

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

output:

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

result:

ok AC

Test #69:

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

input:

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

output:

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

result:

ok AC

Test #70:

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

input:

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

output:

Yes
0

result:

ok AC

Test #71:

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

input:

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

output:

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

result:

ok AC

Test #72:

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

input:

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

output:

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

result:

ok AC

Test #73:

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

input:

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

output:

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

result:

ok AC

Extra Test:

score: 0
Extra Test Passed