#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;
int n;

        /*
  bool solve(){
               if(i==n)
return true;

if(inp[i].second>=inp[i+1].second)
  solve(i+1);
else{
swap(inp[i].second,inp[])
}

}

              */

int main()
{          ll a,b;
 cin>>n;
loop(i,n){
cin>>a>>b;
inp.push_back({a,b});
}

if(inp[0].second<inp[0].first)
swap(inp[0].first,inp[0].second);

loop(i,n-1){
               bool on=false;
/*if(!(inp[i].second>=inp[i+1].second)){
  swap(inp[i].first,inp[i].second);

}                                */
if(!(inp[i].second>=inp[i+1].second)){
//swap(inp[i].first,inp[i].second);
  swap(inp[i+1].first,inp[i+1].second);

}
if(!(inp[i].second>=inp[i+1].second)){
                                    if(i==0){
swap(inp[i].first,inp[i].second);
                                            }

}
if(!(inp[i].second>=inp[i+1].second)){
  cout<<"NO";return 0;

}
/*
loop(i,n){
cout<<inp[i].second<<endl;}                  */
}

cout<<"YES";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;
vector<pair<ll,ll> >inp2;
int n;

  void solve(int i,ll x,ll y){

             if(x<y)
                return ;

 if(i==n-1) {
           cout<<"YES";
             exit(1);}

solve(i+1,inp[i].second,inp[i+1].second);
solve(i+1,inp[i].second,inp[i+1].first);
solve(i+1,inp[i].first,inp[i+1].second);
solve(i+1,inp[i].first,inp[i+1].first);

}

int main()
{          ll a,b;
 cin>>n;
loop(i,n){
cin>>a>>b;
inp.push_back({a,b});
}

solve(-1,2,2);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n,q;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==q-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b,c=0;
 cin>>n;   bool ww=true;
loop(i,n){
scanf("%I64d%I64d",&a,&b)  ;
if(i==0){
inp.push_back({a,b});c++;}
else if(i>1&&(!((a==inp[i-c].first||inp[i-c].second==a||b==inp[i-c].first||inp[i-c].second==b)))){

                 c++;

inp.push_back({a,b});            }
else if(i>1){
i--;
n--;
}

}

         q=inp.size();
//cout<<q<<" #"<<endl;
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n,q;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==q-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b,c=0;
 cin>>n;   bool ww=true;
loop(i,n){
scanf("%I64d%I64d",&a,&b)  ;
if(i==0){
inp.push_back({a,b});c++;}
else if(i&&!(((a==inp[i-c].first&&inp[i-c].second==b)||(b==inp[i-c].first&&inp[i-c].second==a)))){

                 c++;

inp.push_back({a,b});            }

}

         q=inp.size();
//cout<<q<<" #"<<endl;
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n,q;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==q-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b,c=0;
 cin>>n;   bool ww=true;
loop(i,n){
scanf("%I64d%I64d",&a,&b)  ;
if(i==0){
inp.push_back({a,b});c++;}
else if(!(((a==inp[i-c].first&&inp[i-c].second==b)||(b==inp[i-c].first&&inp[i-c].second==a)))){

                 c++;

inp.push_back({a,b});            }
else if(i>1){
i--;
n--;
}

}

         q=inp.size();
//cout<<q<<" #"<<endl;
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n,q;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==q-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b;
 cin>>n;
loop(i,n){
scanf("%I64d%I64d",&a,&b)  ;
if(!(i&&((a==inp[i-1].first||inp[i-1].second==a)||(a==inp[i-1].first||inp[i-1].second==a)))){

inp.push_back({a,b});            }

}
         q=inp.size();
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n;

  void solve(int i,ll x,ll y){

             if(x<y)
                return ;

 if(i==n-1) {
           cout<<"YES";
             exit(1);}

solve(i+1,inp[i].second,inp[i+1].second);
solve(i+1,inp[i].second,inp[i+1].first);
solve(i+1,inp[i].first,inp[i+1].second);
solve(i+1,inp[i].first,inp[i+1].first);

}

int main()
{          ll a,b;
 cin>>n;
loop(i,n){
cin>>a>>b;
inp.push_back({a,b});
}
                inp.push_back({0,0});

solve(0,2,2);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==n-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b;
 cin>>n;
loop(i,n){
cin>>a>>b;
inp.push_back({a,b});
}
                inp.push_back({0,0});
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n,q;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==q-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b,c=0;
 cin>>n;   bool ww=true;
loop(i,n){
scanf("%I64d%I64d",&a,&b)  ;
if(i==0){
inp.push_back({a,b});c++;}
else if((!((a==inp[i-c].first||inp[i-c].second==a||b==inp[i-c].first||inp[i-c].second==b)))){

                 c++;

inp.push_back({a,b});            }
else if(i>1){
i--;
n--;
}

}

         q=inp.size();
//cout<<q<<" #"<<endl;
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;
vector<pair<ll,ll> >inp2;
int n;

        /*
  bool solve(){
               if(i==n)
return true;

if(inp[i].second>=inp[i+1].second)
  solve(i+1);
else{
swap(inp[i].second,inp[])
}

}

              */

int main()
{          ll a,b;
 cin>>n;
loop(i,n){
cin>>a>>b;
inp.push_back({a,b});
}

               inp2=inp;
bool what=true;

loop(i,n-1){

if(!(inp[i].second>=inp[i+1].second)){
  swap(inp[i+1].first,inp[i+1].second);

}

if(!(inp[i].second>=inp[i+1].second)){
  what=false;break;

}
    }

if(what)

cout<<"YES";
else{
         swap(inp2[0].second,inp2[0].first);

loop(i,n-1){

if(!(inp2[i].second>=inp2[i+1].second)){
  swap(inp2[i+1].first,inp2[i+1].second);

}

if(!(inp2[i].second>=inp2[i+1].second)){
  cout<<"NO";return 0;

}
    }

cout<<"YES";

}

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
#define fx fixed
#define setp(n) setprecision(n)
#define OO 1e4
typedef  long long ll;
template <class T>inline void arin(T* st, T* nd){while(st<nd)cin>>*st++;}

const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,-1,1,-1};

class MATH{

                                       	public : MATH(){}
          int count=0;

// ------------------------------------
ll GCD(ll a, ll b) {
	return b == 0 ? a : GCD(b, a % b);
}
//-------------------------------------
ll LCM(ll i, ll j)
{
	return (i*j) / GCD(i, j);
}
//----------------------------------------
ll pows(ll n){return (1<<n);}
//-----------------------------------------
bool is_prime(long long x) {
	if (x <= 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}
};

vector<pair<ll,ll> >inp;

int n,q;

  void solve(int i,ll x,ll y,bool w){
                           // cout<<x<<" "<<y<<endl;
             if(x<y)
                return ;

 if(i==q-1) {
           cout<<"YES";
             exit(0);}
        if(w)
solve(i+1,inp[i].second,inp[i+1].second,1);
if(w)
solve(i+1,inp[i].second,inp[i+1].first,0);
if(!w)
solve(i+1,inp[i].first,inp[i+1].second,1);
if(!w)
solve(i+1,inp[i].first,inp[i+1].first,0);

                          return ;

                                    }

int main()
{          ll a,b,c=0;
 cin>>n;   bool ww=true;
loop(i,n){
scanf("%I64d%I64d",&a,&b)  ;
if(i==0){
inp.push_back({a,b});c++;}
else if(i&&!(((a==inp[i-1].first&&inp[i-1].second==b)||(b==inp[i-1].first&&inp[i-1].second==a)))){

inp.push_back({a,b});            }

}

         q=inp.size();
//cout<<q<<" #"<<endl;
  if(inp[0].second>inp[0].first)
solve(0,2,2,1);
else
solve(0,2,2,0);

       cout<<"NO";

}


#include<bits/stdc++.h>
long long  n, z, x, y;
using namespace std;
int main()
{
    cin>>n;
    z=200000000;
    while(n--)
    {
        cin>>x>>y;
        if (x<y)
        {
          swap(x,y);
        }
        if (x<=z)
        {
          z=x;
        }
        else
        {
          if (y<=z)
          {
            z=y;
          }
          else
          {
            cout<<"NO"<<endl;
            return 0;
          }
        }
  }
  cout<<"YES"<<endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long z = 20000000000;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
        if(max(a,b)<=z)
        {
            z=max(a,b);
        }
        else if(min(a,b)<=z)
        {
            z=min(a,b);
        }
        else
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, d = -1;
  cin>>n;
  while(n--)
  {
    int a, b;
    cin>>a>>b;
    if(a > b)
    {
      swap(a, b);
    }
    if(d != -1 and a>d)
    {
      cout<<"NO";
      return 0;
    }
    if(d == -1)
    {
      d = b;
    }
    else
    {
      if(b>d);
      {
        d =a;
        d =b ;
      }
    }
  }

  cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
long long z = 1000;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
        if(max(a,b)<=z)
        {
            z=max(a,b);
        }
        else if(min(a,b)<=z)
        {
            z=min(a,b);
        }
        else
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long  n, z;
    cin>>n;
    z=200000000;
    while(n--)
    {
        long long  x, y;
        cin>>x>>y;
        if (x<y)
        {
          swap(x,y);
        }
        if (x<=z)
        {
          z=x;
        }
        else
        {
          if (y<=z)
          {
            z=y;
          }
          else
          {
            cout<<"NO"<<endl;
            return 0;
          }
        }
  }
  cout<<"YES"<<endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, z;
    cin>>n;
    z=100;
    while(n--)
    {
        int x, y;
        cin>>x>>y;
        if (x<y)
        {
          swap(x,y);
        }
        if (x<=z)
        {
          z=x;
        }
        else
        {
          if (y<=z)
          {
            z=y;
          }
          else
          {
            cout<<"NO"<<endl;
            return 0;
          }
        }
  }
  cout<<"YES"<<endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long z = 100000000;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
        if(max(a,b)<=z)
        {
            z=max(a,b);
        }
        else if(min(a,b)<=z)
        {
            z=min(a,b);
        }
        else
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, d = -1;
  cin>>n;
  while(n--)
  {
    int a, b;
    cin>>a>>b;
    if(a > b)
    {
      swap(a, b);
    }
    if(d != -1 and a>d)
    {
      cout<<"NO"<<endl;
      return 0;
    }
    if(d == -1)
    {
      d = b;
    }
  }

  cout<<"YES"<<endl;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
	int n;
	cin >> n;

	int a[n][2];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i][0] >> a[i][1];
	}

	int c = 0;

	for (int i = 0; i < n - 1; ++i)
	{
		if (min(a[i][0], a[i][1]) < min(a[i + 1][0], a[i + 1][1]))
		{
			if (a[i][0] == a[i + 1][0] || a[i][0] == a[i + 1][1] || a[i][1] == a[i + 1][0] || a[i][1] == a[i + 1][1] )
			{
				continue;
			}
			c++;
		}
	}

	if (c == 0)
	{
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
	int n;
	cin >> n;

	int a[n][2];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i][0] >> a[i][1];
	}

	long long int res[n];
	res[0] = max(a[0][0], a[0][1]);
	for (int i = 1; i < n; ++i)
	{
		if (res[i - 1] >= max(a[i][0], a[i][1]))
		{
			res[i] = max(a[i][0], a[i][1]);
		} else if (res[i - 1] >= min(a[i][0], a[i][1]))
	  {
	  	res[i] = min(a[i][0], a[i][1]);
		} else {
			cout << "NO" << endl;
			exit(0);
		}
	}

	cout << "YES" << endl;

	return 0;
}


using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define debug(x) cout << (#x) <<  " is " << (x) << endl;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i, a, b, c) for(ll i = a; i < b; i += c)
#define pb push_back

int main()
{
	SPEED
	ll n; cin >> n;
	ll a[n][2];
	for (ll i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	ll lead = max(a[0][0], a[0][1]);
	ll flag1 = 0;
	for (ll i = 1; i < n; i++)
	{
		if (min(a[i][0], a[i][1]) <= lead)
		{
			flag1 = 1; //non acending order possible.
			break;
		}

		else
		{
			lead = max(a[i][0], a[i][1]);
		}
	}

	if (flag1 == 1)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define debug(x) cout << (#x) <<  " is " << (x) << endl;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i, a, b, c) for(ll i = a; i < b; i += c)
#define pb push_back

int main()
{
	SPEED
	ll n; cin >> n;
	ll a[n][2];
	for (ll i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	ll lead = max(a[0][0], a[0][1]);
	ll flag1 = 0;
	for (ll i = 1; i < n; i++)
	{
		if (min(a[i][0], a[i][1]) <= lead)
		{
			if (max(a[i][0], a[i][1]) > lead)
				lead = min(a[i][0], a[i][1]);
			else
			{
				lead = max(a[i][0], a[i][1]);
			}
		}

		else
		{
			flag1 = 1;
			break;
		}

	}

	if (flag1 == 1)
		cout << "NO";
	else
		cout << "YES";
	return 0;
}


using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define debug(x) cout << (#x) <<  " is " << (x) << endl;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i, a, b, c) for(ll i = a; i < b; i += c)
#define pb push_back

int main()
{
	SPEED
	ll n; cin >> n;
	ll a[n][2];
	for (ll i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	ll lead = max(a[0][0], a[0][1]);
	ll flag1 = 0;
	for (ll i = 1; i < n; i++)
	{
		if (min(a[i][0], a[i][1]) <= lead)
		{
			flag1 = 1; //non acending order possible.
			break;
		}

		else
		{
			lead = min(a[i][0], a[i][1]);
		}
	}

	if (flag1 == 1)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define debug(x) cout << (#x) <<  " is " << (x) << endl;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i, a, b, c) for(ll i = a; i < b; i += c)
#define pb push_back

int main()
{
	SPEED
	ll n; cin >> n;
	ll a[n][2];
	for (ll i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	ll lead = max(a[0][0], a[0][1]);
	ll flag1 = 0;
	for (ll i = 1; i < n; i++)
	{
		if (min(a[i][0], a[i][0]) <= lead)
		{
			if (max(a[i][0], a[i][0]) > lead)
				lead = min(a[i][0], a[i][0]);
			else
			{
				lead = max(a[i][0], a[i][0]);
			}
		}

		else
		{
			flag1 = 1;
			break;
		}

	}

	if (flag1 == 1)
		cout << "NO";
	else
		cout << "YES";
	return 0;
}


using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define debug(x) cout << (#x) <<  " is " << (x) << endl;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i, a, b, c) for(ll i = a; i < b; i += c)
#define pb push_back

int main()
{
	SPEED
	ll n; cin >> n;
	ll a[n][2];
	for (ll i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	ll lead = max(a[0][0], a[0][1]);
	ll flag1 = 0;
	for (ll i = 1; i < n; i++)
	{
		if (min(a[i][0], a[i][1]) < lead)
		{
			flag1 = 1; //non acending order possible.
			break;
		}

		else
		{
			lead = max(a[i][0], a[i][1]);
		}
	}

	if (flag1 == 1)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}


using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define debug(x) cout << (#x) <<  " is " << (x) << endl;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i, a, b, c) for(ll i = a; i < b; i += c)
#define pb push_back

int main()
{
	SPEED
	ll n; cin >> n;
	ll a[n][2];
	for (ll i = 0; i < n; i++)
		cin >> a[i][0] >> a[i][1];
	ll lead = max(a[0][0], a[0][1]);
	ll flag1 = 0;
	for (ll i = 1; i < n; i++)
	{
		if (min(a[i][0], a[i][1]) <= lead)
		{
			if (max(a[i][0], a[i][1]) > lead)
				lead = min(a[i][0], a[i][0]);
			else
			{
				lead = max(a[i][0], a[i][1]);
			}
		}

		else
		{
			flag1 = 1;
			break;
		}

	}

	if (flag1 == 1)
		cout << "NO";
	else
		cout << "YES";
	return 0;
}


#include<iostream>
using namespace std;

int main()
{
    int i,n,x,y;
    cin>>n;
    int w[n],h[n];
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>h[i];
    }
    if(w[0]>h[0])
        x=w[0];
    else
        x=h[0];

    for(i=1;i<n;i++)
    {
        if(x<w[i] && x<h[i])
        {
            cout<<"NO";
            return 0;
        }

        else
        {
            if(w[i]>h[i]){
                y=w[i];
                if(y>x)
                y=h[i];

                x=y;
            }
            else
            {
                if(h[i]>x)
                    x=w[i];
                else
                    x=h[i];
            }

        }
    }
    cout<<"YES";
}


#include<iostream>
using namespace std;

int main()
{
    int i,n,x;
    cin>>n;
    int w[n],h[n];
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>h[i];
    }
    if(w[0]>w[1])
        x=w[0];
    else
        x=w[1];

    for(i=1;i<n;i++)
    {
        if(x<w[i] && x<h[i])
        {
            cout<<"NO";
            return 0;
        }

        else
        {
            if(w[i]<=x)
                x=w[i];
            if(h[i]<w[i] && h[i]<=x)
                x=h[i];

        }
    }
    if(i==n)
    cout<<"YES";
}


import java.util.Scanner;

public class Problem510A {

	public static void main(String[] args) {

		drawSnake();

	}

	public static void drawSnake()
	{
		int n,m;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt(); m = sc.nextInt();

		char[][] grid = new char[n][m];

		for(int i=0 ; i<n ; i++)
		{
			if(isEven(i))
			{
				for(int j=0 ; j<m ; j++)
					grid[i][j] = '#';
			}
			else if( (i+1) % 4 == 0)
			{
				printDirection(grid, i, m, 'l');
			}
			else
			{
				printDirection(grid, i, m, 'r');
			}
		}

		for(int i=0 ; i<n ; ++i){
			for(int j=0 ; j<m ; ++j)
				System.out.print(grid[i][j]);
			if(i != n-1)
			System.out.println("\n");
		}
		sc.close();
	}

	public static boolean isEven(int x)
	{
		return (x % 2 == 0) ? true:false;
	}

	public static void printDirection (char[][] grid, int rowNum, int m, char direction)
	{
		if(direction == 'l')
		{
			grid[rowNum][0] = '#';
			for(int j=1 ; j<m ; ++j)
				grid[rowNum][j] = '.';
		}
		else
		{
			grid[rowNum][m-1] = '#';
			for(int j=0 ; j<m-1 ; ++j)
				grid[rowNum][j] = '.';

		}
	}

}


package problems;

import java.util.Scanner;

public class Problem510A {

	public static void main(String[] args) {

		drawSnake();

	}

	public static void drawSnake()
	{
		int n,m;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt(); m = sc.nextInt();

		char[][] grid = new char[n][m];

		for(int i=0 ; i<n ; i++)
		{
			if(isEven(i))
			{
				for(int j=0 ; j<m ; j++)
					grid[i][j] = '#';
			}
			else if( (i+1) % 4 == 0)
			{
				printDirection(grid, i, m, 'l');
			}
			else
			{
				printDirection(grid, i, m, 'r');
			}
		}

		for(int i=0 ; i<n ; ++i){
			for(int j=0 ; j<m ; ++j)
				System.out.print(grid[i][j]);
			if(i != n-1)
			System.out.println("\n");
		}
		sc.close();
	}

	public static boolean isEven(int x)
	{
		return (x % 2 == 0) ? true:false;
	}

	public static void printDirection (char[][] grid, int rowNum, int m, char direction)
	{
		if(direction == 'l')
		{
			grid[rowNum][0] = '#';
			for(int j=1 ; j<m ; ++j)
				grid[rowNum][j] = '.';
		}
		else
		{
			grid[rowNum][m-1] = '#';
			for(int j=0 ; j<m-1 ; ++j)
				grid[rowNum][j] = '.';

		}
	}

}


import java.util.Scanner;

public class Problem510A {

	public static void main(String[] args) {

		drawSnake();

	}

	public static void drawSnake()
	{
		int n,m;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt(); m = sc.nextInt();

		char[][] grid = new char[n][m];

		for(int i=0 ; i<n ; i++)
		{
			if(isEven(i))
			{
				for(int j=0 ; j<m ; j++)
					grid[i][j] = '#';
			}
			else if( (i+1) % 4 == 0)
			{
				printDirection(grid, i, m, 'l');
			}
			else
			{
				printDirection(grid, i, m, 'r');
			}
		}

		for(int i=0 ; i<n ; ++i){
			for(int j=0 ; j<m ; ++j)
				System.out.print(grid[i][j]);
			if(i != n-1)
			System.out.print("\n");
		}
		sc.close();
	}

	public static boolean isEven(int x)
	{
		return (x % 2 == 0) ? true:false;
	}

	public static void printDirection (char[][] grid, int rowNum, int m, char direction)
	{
		if(direction == 'l')
		{
			grid[rowNum][0] = '#';
			for(int j=1 ; j<m ; ++j)
				grid[rowNum][j] = '.';
		}
		else
		{
			grid[rowNum][m-1] = '#';
			for(int j=0 ; j<m-1 ; ++j)
				grid[rowNum][j] = '.';

		}
	}

}


import java.util.*;

public class A510{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int h = sc.nextInt();

        String ls = "", h1 = "", h2 = "";

        long time = System.nanoTime();

        for(int i = 1; i <= l; i++){
            if(i % 2 == 0){
                if(i % 4 == 0){
                    if(!h2.isEmpty()){
                        System.out.println(h2);
                    }else{
                        h2 += "#";
                        for(int j = 1; j < l; j++){
                            h2 += ".";
                        }
                        System.out.println(h2);
                    }
                }else{
                    if(!h1.isEmpty()){
                        System.out.println(h1);
                    }else{
                        for(int j = 1; j < l; j++){
                            h1 += ".";
                        }
                        h1 += "#";
                        System.out.println(h1);
                    }
                }
            }else{
                if(!ls.isEmpty()){
                    System.out.println(ls);
                }else{
                    for(int j = 0; j < h; j++){
                        ls += "#";
                    }
                    System.out.println(ls);
                }
            }
        }
	}
}


import java.util.*;

public class A510{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int h = sc.nextInt();

        String ls = "", h1 = "", h2 = "";

        long time = System.nanoTime();

        for(int i = 1; i <= l; i++){
            if(i % 2 == 0){
                if(i % 4 == 0){
                    if(!h2.isEmpty()){
                        System.out.println(h2);
                    }else{
                        h2 += "#";
                        for(int j = 1; j < l; j++){
                            h2 += ".";
                        }
                        System.out.println(h2);
                    }
                }else{
                    if(!h1.isEmpty()){
                        System.out.println(h1);
                    }else{
                        for(int j = 1; j < l; j++){
                            h1 += ".";
                        }
                        h1 += "#";
                        System.out.println(h1);
                    }
                }
            }else{
                if(!ls.isEmpty()){
                    System.out.println(ls);
                }else{
                    for(int j = 0; j < h; j++){
                        ls += "#";
                    }
                    System.out.println(ls);
                }
            }
        }
        System.out.println(System.nanoTime() - time);
	}
}


import java.util.*;

public class A510{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int h = sc.nextInt();

        String ls = "", h1 = "", h2 = "";

        for(int i = 1; i <= l; i++){
            if(i % 2 == 0){
                if(i % 4 == 0){
                    if(!h2.isEmpty()){
                        System.out.println(h2);
                    }else{
                        h2 += "#";
                        for(int j = 1; j < h; j++){
                            h2 += ".";
                        }
                        System.out.println(h2);
                    }
                }else{
                    if(!h1.isEmpty()){
                        System.out.println(h1);
                    }else{
                        for(int j = 1; j < h; j++){
                            h1 += ".";
                        }
                        h1 += "#";
                        System.out.println(h1);
                    }
                }
            }else{
                if(!ls.isEmpty()){
                    System.out.println(ls);
                }else{
                    for(int j = 0; j < h; j++){
                        ls += "#";
                    }
                    System.out.println(ls);
                }
            }
        }
	}
}


import java.util.*;
import java.io.*;

public class A510 {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int n = Integer.parseInt(s[0]), m = Integer.parseInt(s[1]);
        for(int i =0;i<n;i++){
            for(int j=0;j<m;j++){
                if(i%2 ==0){
                    p("#");
                }else{
                    if(i%4 != 1){
                        if(j==0){
                            p("#");
                        }else{
                            p(".");
                        }
                    }else{
                        if(j== m-1){
                            p("#");
                        }else{
                            p(".");
                        }
                    }
                }

            }
            pln("");
        }
    }
    public static <T> void pln(T val){
        System.out.println(val);
    }
    public static <T> void p(T val){
        System.out.print(val);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
 public static void main(String[] args) throws IOException{
	//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	Scanner sc=new Scanner(System.in);
	int n=sc.nextInt();int c=1;
	int m=sc.nextInt();
	for(int i=0;i<n;i++){
		if(i%2==0){
			for(int j=0;j<m;j++)
				System.out.print("#");
		}
		else{
			if(c==1){
			for(int j=1;j<m;j++)
				System.out.print(".");
			System.out.print("#");
			c=c*-1;
			}
			else{
				System.out.print("#");
				for(int j=1;j<m;j++)
					System.out.print(".");

				c=c*-1;
				}
		}
		System.out.println();
	}
 }
}


import java.util.*;
public class Q510A{
    public static void main(String args[]){
            Scanner sc=new Scanner(System.in);
                int n=sc.nextInt();int c=1;
                    int m=sc.nextInt();
                        for(int i=0;i<n;i++){
                                    if(i%2==0){
                                                    for(int j=0;j<m;j++)
                                                                        System.out.print("#");
                                                            }
                                            else{
                                                            if(c==1){
                                                                            for(int j=1;j<m;j++)
                                                                                System.out.print(".");
                                                                                System.out.print("#");
                                                                                c=c*-1;
                                                                                }
                                                                        else{
                                                                                System.out.print("#");
                                                                                for(int j=1;j<m;j++)
                                                                                System.out.print(".");

                                                                                c=c*-1;
                                                                                }
                                                                                }
                                                    System.out.println();
                                                        }
    }
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
	int c=0;
		for(int i=0;i<n;i++)
		{
		    if(i%2==0)
		    {
		        for(int j=0;j<m;j++)
		         System.out.print("#");
		    }
		    else
		     {c++;
		    if(c%2==1)
		    {
		        for(int j=0;j<m-1;j++)
		         System.out.print(".");
		        System.out.print("#");
		    }
		    else
		    { System.out.print("#");
		        for(int j=1;j<m;j++)
		         System.out.print(".");

		    }
		     }
		    System.out.println();
		}
	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		for(int i=0;i<n;i++)
		{
		    if(i%2==0)
		    {
		        for(int j=0;j<m;j++)
		         System.out.print("#");
		    }
		    else
		    {
		        for(int j=0;j<m-1;j++)
		         System.out.print(".");
		        System.out.print("#");
		    }
		    System.out.println();
		}
	}
}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
	int c=0;
		for(int i=0;i<n;i++)
		{
		    if(i%2==0)
		    {
		        for(int j=0;j<m;j++)
		         System.out.print("#");
		    }
		    else
		     {c++;
		    if(c%2==1)
		    {
		        for(int j=0;j<m-1;j++)
		         System.out.print(".");
		        System.out.print("#");
		    }
		    else
		    { System.out.print("#");
		        for(int j=1;j<m-1;j++)
		         System.out.print(".");

		    }
		     }
		    System.out.println();
		}
	}
}


import java.util.*;
public class FoxAndSnake
{
    public static void main(String[] args)
    {
        int m,n,flag=0,i,j;
        Scanner sc=new Scanner(System.in);
        m=sc.nextInt();
        n=sc.nextInt();
        int count=n/2,k=0;
        for(i=1;i<=m;i++)
        {
            if(i%2==0)
            {
                k++;
            }
            for(j=1;j<=n;j++)
            {
                if(i%2==0&&j==m&&k<=count&&k%2!=0)
                {
                    System.out.print('#');

                }
                else if(i%2==0&&j==1&&k<=count&&k%2==0)
                {
                    System.out.print('#');

                }
                else if(i%2!=0)
                {
                    System.out.print('#');
                }
                else
                {
                    System.out.print('.');
                }

            }

            System.out.println();
        }
    }
}


import java.util.*;
public class FoxAndSnake
{
    public static void main(String[] args)
    {
        int m,n,flag=0,i,j;
        Scanner sc=new Scanner(System.in);
        m=sc.nextInt();
        n=sc.nextInt();
        int count=n/2,k=0;
        for(i=1;i<=m;i++)
        {
            if(i%2==0)
            {
                k++;
            }
            for(j=1;j<=n;j++)
            {
                if(i%2==0&&j==n&&k<=count&&k%2!=0)
                {
                    System.out.print('#');

                }
                else if(i%2==0&&j==1&&k<=count&&k%2==0)
                {
                    System.out.print('#');

                }
                else if(i%2!=0)
                {
                    System.out.print('#');
                }
                else
                {
                    System.out.print('.');
                }

            }

            System.out.println();
        }
    }
}


import java.util.*;
public class FoxAndSnake
{
    public static void main(String[] args)
    {
        int m,n,flag=0,i,j;
        Scanner sc=new Scanner(System.in);
        m=sc.nextInt();
        n=sc.nextInt();
        int count=m/2,k=0;
        for(i=1;i<=m;i++)
        {
            if(i%2==0)
            {
                k++;
            }
            for(j=1;j<=n;j++)
            {
                if(i%2==0&&j==n&&k<=count&&k%2!=0)
                {
                    System.out.print('#');

                }
                else if(i%2==0&&j==1&&k<=count&&k%2==0)
                {
                    System.out.print('#');

                }
                else if(i%2!=0)
                {
                    System.out.print('#');
                }
                else
                {
                    System.out.print('.');
                }

            }

            System.out.println();
        }
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

     Scanner input = new Scanner(System.in);
     int n = input.nextInt();
     int m = input.nextInt();
     int counter = 0 ;

     boolean turn = true ;
     for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m  ;  j++){
            if(counter % 2 == 0){
                System.out.print("#");
            }else if(counter % 2 != 0 && counter % 4 == 1){

                      if(j != m -1 ){
                       System.out.print(".");
                      }else{

                       System.out.print("#");
                    }

                }else if(counter % 2 != 0 && counter % 4 == 3) {
                    if(j == 0){
                        System.out.print("#");
                    }else{
                         System.out.print(".");
                    }

                }

            }
       System.out.println();
       counter++;
     }
    }

}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

     Scanner input = new Scanner(System.in);
     int n = input.nextInt();
     int m = input.nextInt();
     int counter = 0 ;
     boolean turn = true;
     for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m  ; j++){
            if(counter % 2 == 0)
                System.out.print("#");
             else
                if(turn){

                    if(j == m - 1 ){
                       System.out.print("#");

                    }else{
                      System.out.print(".");
                    }
                    turn = false;
                }else{
                    if(j == 0)
                        System.out.print("#");
                    else
                         System.out.print(".");

                    turn = true;
                }
        }
       System.out.println();
       counter++;
     }
    }

}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

     Scanner input = new Scanner(System.in);
     int n = input.nextInt();
     int m = input.nextInt();
     int counter = 0 ;
     boolean turn = true;
     for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < m  ; j++){
            if(counter % 2 == 0)
                System.out.print("#");
             else
                if(turn){

                    if(j == m - 1 ){
                       System.out.print("#");

                    }
                      System.out.print(".");

                    turn = false;
                }else{
                    if(j == 0)
                        System.out.print("#");
                    else
                         System.out.print(".");

                    turn = true;
                }
        }
       System.out.println();
       counter++;
     }
    }

}


import java.util.Scanner;

/**
 *
 * @author hussam
 */
public class BackToProblemSolving {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int r = in.nextInt(),c = in.nextInt();
        String snack="";
        for (int i = 0; i < r; i++) {
            if(i % 2 ==0)
             snack = repeat("#",c);
            else
               snack  = leftPad(".", c, "#");

            System.out.println(snack);
        }
    }
    public static String repeat(String s, int length)
    {
        String temp = "";
        for (int i = 0; i < length; i++) {
            temp +=s;
        }

        return temp;
    }
    public static String leftPad(String s , int length,String paddedStr)
    {
        String temp ="";
        for (int i = 0; i < length-1; i++) {
            temp += s;
        }
        temp+=paddedStr;
        return temp;

    }
}


import java.util.Scanner;

/**
 *
 * @author hussam
 */
public class BackToProblemSolving {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int r = in.nextInt(),c = in.nextInt();
        String snack="";
        boolean isLeftPad = true;
        for (int i = 0; i < r; i++) {
            if(i % 2 ==0)
             snack = repeat("#",c);
            else{
                if(isLeftPad)
                {
                    snack  = leftPad(".", c, "#");
                    isLeftPad = false;
                }
                else
                {
                    snack = rightPad(".",c,"#");
                    isLeftPad = true;
                }
            }

            System.out.println(snack);
        }
    }
    public static String repeat(String s, int length)
    {
        String temp = "";
        for (int i = 0; i < length; i++) {
            temp +=s;
        }

        return temp;
    }
    public static String leftPad(String s , int length,String paddedStr)
    {
        String temp ="";
        for (int i = 0; i < length-1; i++) {
            temp += s;
        }
        temp+=paddedStr;
        return temp;

    }
    public static String rightPad(String s , int length,String paddedStr)
    {
        String temp ="#";
        for (int i = 1; i < length; i++) {
            temp += s;
        }

        return temp;

    }

}


import java.util.Scanner;
import org.apache.commons.lang.StringUtils;

/**
 *
 * @author hussam
 */
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int r = in.nextInt(),c = in.nextInt();
        String snack="";
        for (int i = 0; i < r; i++) {
            if(i % 2 ==0)
             snack = StringUtils.repeat("#",c);
            else
               snack  = StringUtils.leftPad("#",c,".");

            System.out.println(snack);
        }
    }
}


import java.util.Scanner;
import org.apache.commons.lang.StringUtils;

/**
 *
 * @author hussam
 */
public class BackToProblemSolving {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int r = in.nextInt(),c = in.nextInt();
        String snack="", snackCarve = "";
        for (int i = 0; i < r; i++) {
            if(i % 2 ==0)
             snack = StringUtils.repeat("#",c);
            else
               snack  = StringUtils.leftPad("#",c,".");

            System.out.println(snack);
        }
    }
}


import java.util.Scanner;

/**
 *
 * @author hussam
 */
public class BackToProblemSolving {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int r = in.nextInt(),c = in.nextInt();
        String snack="";
        for (int i = 0; i < r; i++) {
            if(i % 2 ==0)
             snack = repeat("#",c);
            else
               snack  = leftPad(".", r, "#");

            System.out.println(snack);
        }
    }
    public static String repeat(String s, int length)
    {
        String temp = "";
        for (int i = 0; i < length; i++) {
            temp +=s;
        }

        return temp;
    }
    public static String leftPad(String s , int length,String paddedStr)
    {
        String temp ="";
        for (int i = 0; i < length-1; i++) {
            temp += s;
        }
        temp+=paddedStr;
        return temp;

    }
}


package javaapplication2;

import java.util.Scanner;

public class JavaApplication2 {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        if (n >= 3 && n % 2 != 0 && m <= 50) {
            for (int i = 1; i <= n; i++) {
                if (i % 2 != 0) {
                    for (int j = 1; j <= m; j++) {
                        System.out.print("#");
                    }
                } else if (i % 4 != 0 || i == 2) {
                    for (int j = 1; j < m; j++) {
                        System.out.print(".");
                    }
                    System.out.print("#");
                } else {
                    System.out.print("#");
                    for (int j = 1; j < m; j++) {
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
        }

    }
}


package javaapplication2;

import java.util.Scanner;

public class JavaApplication2 {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        if (n >= 3 && n % 2 != 0 && m <= 50) {
            for (int i = 1; i <= n; i++) {
                if (i % 2 != 0) {
                    for (int j = 1; j <= m; j++) {
                        System.out.print("#");
                    }
                } else if (i % 4 != 0 || i == 2) {
                    for (int j = 1; j < m; j++) {
                        System.out.print(".");
                    }
                    System.out.print("#");
                } else {
                    System.out.print("#");
                    for (int j = 1; j < m; j++) {
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
        } else {
            throw new AssertionError();
        }
    }
}


import java.util.Scanner;

public class JavaApplication2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if (n >= 3 && n % 2 != 0 && m <= 50) {
            for (int i = 1; i <= n; i++) {
                if (i % 2 != 0) {
                    for (int j = 1; j <= m; j++) {
                        System.out.print("#");
                    }
                } else if (i % 4 != 0 || i == 2) {
                    for (int j = 1; j < m; j++) {
                        System.out.print(".");
                    }
                    System.out.print("#");
                } else {
                    System.out.print("#");
                    for (int j = 1; j < m; j++) {
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
        } else {
            throw new AssertionError();
        }
    }
}


import java.io.*;
import java.util.*;
public class Main
{
 public static void main(String[] args)
{
 Scanner s=new Scanner(System.in);
 int m=s.nextInt();
 int n=s.nextInt();
 int i,j;
 char[][] a=new char[m][n];
 for(i=0;i<m;i++)
{
 for(j=0;j<n;j++)
{
if(i==0||i%2!=0)
 a[i][j]='#';
else if(i%2==0&&i%4==0)
{
 if(j==0)
 a[i][j]='#';
 else
 a[i][j]='.';
}
else if(i%2==0&&i%4!=0)
{
 if(j==n-1)
 a[i][j]='#';
else
a[i][j]='.';
}
}
}
 for(i=0;i<m;i++)
{
 for(j=0;j<n;j++)
{
System.out.print(a[i][j]);
}System.out.println();}
}
}


import java.io.*;
import java.util.*;
public class Main
{
 public static void main(String[] args)throws IOException
{
 Scanner s=new Scanner(System.in);
 int m=s.nextInt();
 int n=s.nextInt();
 int i,j;
 char[][] a=new char[m][n];
 for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
{
if(i==1||i%2!=0)
 a[i][j]='#';
else if(i%2==0&&i%4==0)
{
 if(j==1)
 a[i][j]='#';
 else
 a[i][j]='.';
}
else if(i%2==0&&i%4!=0)
{
 if(j==n)
 a[i][j]='#';
else
a[i][j]='.';
}
}
}
 for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
{
System.out.print(a[i][j]);
}System.out.println();}
}
}


import java.io.*;
import java.util.*;
public class Main
{
 public static void main(String[] args)
{
 Scanner s=new Scanner(System.in);
 int m=s.nextInt();
 int n=s.nextInt();
 int i,j;
 char[][] a=new char[m][n];
 for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
{
if(i==1||i%2!=0)
 a[i][j]='#';
else if(i%2==0&&i%4==0)
{
 if(j==0)
 a[i][j]='#';
 else
 a[i][j]='.';
}
else if(i%2==0&&i%4!=0)
{
 if(j==n-1)
 a[i][j]='#';
else
a[i][j]='.';
}
}
}
 for(i=0;i<m;i++)
{
 for(j=0;j<n;j++)
{
System.out.print(a[i][j]);
}System.out.println();}
}
}


import java.io.*;
import java.util.*;
public class Main
{
 public static void main(String[] args)throws IOException
{
 Scanner s=new Scanner(System.in);
 int m=s.nextInt();
 int n=s.nextInt();
 int i,j;
 char[][] a=new char[m][n];
 for(i=1;i<=m;i++)
{
 for(j=1;j<=n;j++)
{
if(i==1||i%2!=0)
 System.out.print('#');
else if(i%2==0&&i%4==0)
{
 if(j==1)
 System.out.print('#');
 else
System.out.print('.');
}
else if(i%2==0&&i%4!=0)
{
 if(j==n)
 System.out.print('#');
else
System.out.print('.');
}
}System.out.println();
}
 }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int width=n;
        if(m>n){width=m;}
        Character [][]arr=new Character[n][width];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            if(i<n-1){
                i++;
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][k]='.';}
                else{arr[i][k]='#';}
            }
        }
        if(i<n-1){
            i++;
            for(int l=m-1;l>=0;l--){
                arr[i][l]='#';
            }
        }

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.print(arr[ip][jp]);
            }System.out.println();
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        Character [][]arr=new Character[n][n];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            if(i<n-1){
                i++;
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][k]='.';}
                else{arr[i][k]='#';}
            }
        }
        if(i<n-1){
            i++;
            for(int l=m-1;l>=0;l--){
                arr[i][l]='#';
            }
        }

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.println(arr[ip][jp]);
            }
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int width=n;
        boolean flag=true;
        if(m>n){width=m;}
        Character [][]arr=new Character[n][width];
        for(int i=0;i<n;i++){
            if(i%2==0){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            }else if(i%2==1){
            for(int k=0;k<m;k++){
                if(flag==true){
                if(k<m-1){arr[i][k]='.';}
                else{flag=false;
                    arr[i][k]='#';}
                }else{
                  if(k>0){arr[i][k]='.';}
                 else{
                    arr[i][k]='#';}
                if(k==m-1){flag=true;}
                }
            }

            }

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.print(arr[ip][jp]);
            }System.out.println();
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int width=n;
        if(m>n){width=m;}
        Character [][]arr=new Character[n][width];
        for(int i=0;i<n;i++){
            if(i%2==0){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            }else if(i%2==1){
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][k]='.';}
                else{arr[i][k]='#';}
            }}

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.print(arr[ip][jp]);
            }System.out.println();
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        Character [][]arr=new Character[n][n];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            if(i<n-1){
                i++;
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][j]='.';}
                else{arr[i][j]='#';}
            }
        }
        if(i<n-1){
            i++;
            for(int l=m-1;l>=0;l--){
                arr[i][l]='#';
            }
        }

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.println(arr[ip][jp]);
            }
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        Character [][]arr=new Character[n][n];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            if(i<n-1){
                i++;
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][k]='.';}
                else{arr[i][k]='#';}
            }
        }
        if(i<n-1){
            i++;
            for(int l=m-1;l>=0;l--){
                arr[i][l]='#';
            }
        }

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.print(arr[ip][jp]);
            }System.out.println();
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int width=n;
        if(m>n){width=m;}
        Character [][]arr=new Character[n][width];
        for(int i=0;i<n;i++){
            if(i%2==1){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            }else if(i%2==0){
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][k]='.';}
                else{arr[i][k]='#';}
            }}

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.print(arr[ip][jp]);
            }System.out.println();
        }

    }
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        Character [][]arr=new Character[n][n];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                arr[i][j]='#';
            }
            if(i<n-1){
                i++;
            for(int k=0;k<m;k++){
                if(k<m-1){arr[i][j]='.';}
                else{arr[i][k]='#';}
            }
        }
        if(i<n-1){
            i++;
            for(int l=m-1;l>=0;l--){
                arr[i][l]='#';
            }
        }

        }
        for(int ip=0;ip<n;ip++){
            for(int jp=0;jp<m;jp++){
                System.out.println(arr[ip][jp]);
            }
        }

    }
}


import java.util.Scanner;

public class Snake
{
	public static void main(String[] args)
	{

		Scanner input = new Scanner(System.in);

		int r = input.nextInt();
		int c = input.nextInt();

		String[][] snake = new String[r][c];

		int count = 1;

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if((i % 2) == 0)
				{
					snake[i][j] = "#";
				}
				else if((((i % 2)) == 1) && (count % 2 == 1))
				{
					snake[i][snake[i].length - 1] = "#";

				}
				else if((((i % 2)) == 1) && ((count % 2) == 0))
				{
					snake[i][0] = "#";

				}
				else
				{
					snake[i][j] = ".";
				}

			}

			if((i % 2) == 1)
				count++;

		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if(snake[i][j] == null)
				{
					snake[i][j] = ".";
				}

			}
		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				System.out.print(snake[i][j]+ " ");

			}

			System.out.println();
		}

	}
}


import java.util.Scanner;

public class Snake
{
	public static void main(String[] args)
	{

		Scanner input = new Scanner(System.in);

		int r = input.nextInt();
		int c = input.nextInt();

		String[][] snake = new String[r][c];

		int count = 1;

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if((i % 2) == 0)
				{
					snake[i][j] = "#";
				}
				else if((((i % 2)) == 1) && (count % 2 == 1))
				{
					snake[i][snake[i].length - 1] = "#";

				}
				else if((((i % 2)) == 1) && ((count % 2) == 0))
				{
					snake[i][0] = "#";

				}
				else
				{
					snake[i][j] = ".";
				}

			}

			if((i % 2) == 1)
				count++;

		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if(snake[i][j] == null)
				{
					snake[i][j] = ".";
				}

			}
		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				System.out.print(snake[i][j]);

			}

			System.out.println();
		}

	}
}


import java.util.Scanner;

public class Snake
{

	public static void main(String[] args)
	{

		Scanner input = new Scanner(System.in);

		int x = input.nextInt();
		int y = input.nextInt();
		int repetition = 0;
		String[][] body = new String[x][y];

		for(int i = 0; i < body.length; i++)
		{
			if(i % 2 == 0)
			{
				for(int j = 0; j < body[0].length; j++)
				{
					if((i % 2) == 0)
					{
						body[i][j] = "#";
					}
				}
			}
			else
			{
				for(int j = 0; j < body[0].length; j++)
				{
					if((i % 2) != 0)
					{
						body[i][j] = ".";
					}
				}

				if(repetition % 2 == 0 )
				{
					body[i][body[0].length - 1] = "#";
				}
				else
				{
					body[i][0] = "#";
				}

				repetition++;
			}

		}

		for(int i = 0; i < body.length; i++)
		{
			for(int j = 0; j < body[0].length; j++)
			{
				System.out.print(body[i][j]);
			}
			System.out.println();
		}

	}
}


import java.util.Scanner;

public class Snake2
{
	public static void main(String[] args)
	{

		Scanner input = new Scanner(System.in);

		int r = input.nextInt();
		int c = input.nextInt();

		String[][] snake = new String[r][c];

		int count = 1;

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if((i % 2) == 0)
				{
					snake[i][j] = "#";
				}
				else if((((i % 2)) == 1) && (count % 2 == 1))
				{
					snake[i][snake[i].length - 1] = "#";

				}
				else if((((i % 2)) == 1) && ((count % 2) == 0))
				{
					snake[i][0] = "#";

				}
				else
				{
					snake[i][j] = ".";
				}

			}

			if((i % 2) == 1)
				count++;

		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if(snake[i][j] == null)
				{
					snake[i][j] = ".";
				}

			}
		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				System.out.print(snake[i][j]);

			}

			System.out.println();
		}

	}
}


import java.util.Scanner;

public class Snake
{

	public static void main(String[] args)
	{

		Scanner input = new Scanner(System.in);

		int x = input.nextInt();
		int y = input.nextInt();
		int repetition = 0;
		String[][] body = new String[x][y];

		for(int i = 0; i < body.length; i++)
		{
			if(i % 2 == 0)
			{
				for(int j = 0; j < body[0].length; j++)
				{
					if((i % 2) == 0)
					{
						body[i][j] = "#";
					}
				}
			}
			else
			{
				for(int j = 0; j < body[0].length; j++)
				{
					if((i % 2) != 0)
					{
						body[i][j] = ".";
					}
				}

				if(repetition % 2 == 0 )
				{
					body[i][body[0].length - 1] = "#";
				}
				else
				{
					body[i][0] = "#";
				}

				repetition++;
			}

		}

		for(int i = 0; i < body.length; i++)
		{
			for(int j = 0; j < body[0].length; j++)
			{
				System.out.print(body[i][j] + " ");
			}
			System.out.println();
		}

	}
}


import java.util.Scanner;

public class Snake1
{
	public static void main(String[] args)
	{

		Scanner input = new Scanner(System.in);

		int r = input.nextInt();
		int c = input.nextInt();

		String[][] snake = new String[r][c];

		int count = 1;

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if((i % 2) == 0)
				{
					snake[i][j] = "#";
				}
				else if((((i % 2)) == 1) && (count % 2 == 1))
				{
					snake[i][snake[i].length - 1] = "#";

				}
				else if((((i % 2)) == 1) && ((count % 2) == 0))
				{
					snake[i][0] = "#";

				}
				else
				{
					snake[i][j] = ".";
				}

			}

			if((i % 2) == 1)
				count++;

		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				if(snake[i][j] == null)
				{
					snake[i][j] = ".";
				}

			}
		}

		for(int i = 0; i < snake.length; i++)
		{
			for(int j = 0 ; j < snake[i].length; j++)
			{
				System.out.print(snake[i][j]);

			}

			System.out.println();
		}

	}
}


import java.util.*;

public class FoxAndSnake
{
	public static void main(String args[])
	{
		int n,m,count=0;
		Scanner s=new Scanner(System.in);
		n=s.nextInt();
		m=s.nextInt();
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(i%2!=0)
				{
					System.out.print("#");
				}
				else if(i%2==0 && j<m && count==0)
				{
					System.out.print(".");
				}
				else if(i%2==0 && j==m && count==0)
				{
					System.out.print("#");
					count=1;
				}
				else if(i%2==0 && j==1 && count==1)
				{
					System.out.print("#");
				}
				else if(i%2==0 && j>1 && j<=m && count==1)
				{
					if(j<m)
					{
						System.out.print(".");
					}
					else
					{
						System.out.print(".");
						count=0;
					}
				}
			}
			System.out.println();
		}
	}
}


import java.util.*;

public class FoxAndSnake
{
	public static void main(String args[])
	{
		int n,m,count=0;
		Scanner s=new Scanner(System.in);
		n=s.nextInt();
		m=s.nextInt();
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(i%2!=0)
				{
					System.out.print("#");
				}
				else if(i%2==0 && j<m && count==0)
				{
					System.out.print(".");
				}
				else if(i%2==0 && j==m && count==0)
				{
					System.out.print("#");
					count=1;
				}
				else if(i%2==0 && j<m && count==1)
				{
					System.out.print("#");
				}
				else if(i%2==0 && j==m && count==1)
				{
					System.out.print(".");
					count=0;
				}
			}
			System.out.println();
		}
	}
}


import java.util.*;

public class FoxAndSnake
{
	public static void main(String args[])
	{
		int n,m;
		Scanner s=new Scanner(System.in);
		n=s.nextInt();
		m=s.nextInt();
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(i%2!=0)
				{
					System.out.print("#");
				}
				else if(i%2==0 && j<m)
				{
					System.out.print(".");
				}
				else if(i%2==0 && j==m)
				{
					System.out.print("#");
				}
			}
			System.out.println();
		}
	}
}


import static java.lang.Integer.min;

import static java.lang.Math.abs;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in=new Scanner(System.in);

        int n,m;

        n=in.nextInt();

        m=in.nextInt();

        char [] [] s=new char[55][55];

        for(int i=0;i<n;i++){

            if(i%2==0) for(int j=0;j<m;j++) s[i][j]='#';

            if(i%4==3) {

                s[i][0]='#';

                for(int j=0;j<m;j++) s[i][j]='.';

            }

            if(i%4==1){

                for(int j=0;j<m-1;j++) s[i][j]='.';

                s[i][m-1]='#';

            }

        }

        for(int i=0;i<n;i++) {

            for(int j=0;j<m;j++) System.out.print(s[i][j]);

            System.out.println();

        }

    }

}


import static java.lang.Integer.min;

import static java.lang.Math.abs;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in=new Scanner(System.in);

        int n,m;

        n=in.nextInt();

        m=in.nextInt();

        char [] [] s=new char[55][55];

        for(int i=0;i<n;i++){

            if(i%2==0) for(int j=0;j<m;j++) s[i][j]='#';

            if(i%4==3) {

                s[i][0]='#';

                for(int j=1;j<m;j++) s[i][j]='.';

            }

            if(i%4==1){

                for(int j=0;j<m-1;j++) s[i][j]='.';

                s[i][m-1]='#';

            }

        }

        for(int i=0;i<n;i++) {

            for(int j=0;j<m;j++) System.out.print(s[i][j]);

            System.out.println();

        }

    }

}


import java.util.*;

public class Main {

    /**

     * @param args the command line arguments

     */

    public static void main(String[] args) {

        // TODO code application logic here

        Scanner in=new Scanner(System.in);

        int n, m;

        n=in.nextInt();

        m=in.nextInt();

        char [][] s=new char [55][55];

        for(int i=0; i<n; i++) {

            if(i%2==0)    for(int j=0; j<m; j++)    s[i][j]='#';

            if(i%4==3){

                s[i][0]='#';

                for(int j=1; j<m; j++) s[i][j]='.';

            }

            if(i%4==1){

                for (int j = 0; j < m - 1; j++) s[i][j] = '.';

                s[i][m - 1] = '#';

            }

        }

        for(int i=0; i<n; i++) {

            for(int j=0; j<m; j++)  System.out.print(s[i][j]);

            System.out.println();

        }

    }

}


import java.util.Scanner;

public class JavaApplication8 {

    public static void main(String[] args) {
        int n,m,count=0,count1=0;
        Scanner s=new Scanner (System.in);
        n=s.nextInt();
        m=s.nextInt();

           for (int i=1;i<=n;i++){
               if (i%2!=0){
                   for (int k=1;k<=m;k++){System.out.print("#");
                   if (k==n)System.out.println("");}}
              if (i%2==0){
                  if (count<=count1){
                      for (int x=1;x<=m-1;x++){
                          System.out.print(".");count++;}
                      System.out.print("#");}
                  else {System.out.print("#");
                       for (int x=1;x<=m-1;x++){
                          System.out.print(".");count1++;}
                  }

                  System.out.println("");

              }

           }


import java.util.Scanner;

public class JavaApplication8 {

    public static void main(String[] args) {
        int n,m,count=0,count1=0;
        Scanner s=new Scanner (System.in);
        n=s.nextInt();
        m=s.nextInt();

           for (int i=1;i<=n;i++){
               if (i%2!=0){
                   for (int k=1;k<=m;k++){System.out.print("#");
                   if (k==m)System.out.println("");}}
              if (i%2==0){
                  if (count<=count1){
                      for (int x=1;x<=m-1;x++){
                          System.out.print(".");count++;}
                      System.out.print("#");}
                  else {System.out.print("#");
                       for (int x=1;x<=m-1;x++){
                          System.out.print(".");count1++;}
                  }

                  System.out.println("");

              }

  }

    }

}


import java.util.Scanner;

public class JavaApplication8 {

    public static void main(String[] args) {
        int n,m,count=0,count1=0;
        Scanner s=new Scanner (System.in);
        n=s.nextInt();
        m=s.nextInt();

           for (int i=1;i<=n;i++){
               if (i%2!=0){
                   for (int k=1;k<=m;k++){System.out.print("#");
                   if (k==n)System.out.println("");}}
              if (i%2==0){
                  if (count<=count1){
                      for (int x=1;x<=m-1;x++){
                          System.out.print(".");count++;}
                      System.out.print("#");}
                  else {System.out.print("#");
                       for (int x=1;x<=m-1;x++){
                          System.out.print(".");count1++;}
                  }

                  System.out.println("");

              }

  }

    }

}


import java.util.Scanner;

public class JavaApplication8 {

    public static void main(String[] args) {
        int n,m,count=0,count1=0;
        Scanner s=new Scanner (System.in);
        n=s.nextInt();
        m=s.nextInt();

           for (int i=1;i<=n;i++){
               if (i%2!=0){
                   for (int k=1;k<=m;k++){System.out.print("#");
                   if (k==n)System.out.println("");}}
              if (i%2==0){
                  if (count<=count1){
                      for (int x=1;x<=m-1;x++){
                          System.out.print(".");count++;}
                      System.out.print("#");}
                  else {System.out.print("#");
                       for (int x=1;x<=m-1;x++){
                          System.out.print(".");count1++;}
                  }

                  System.out.println("");

              }

           }

    }

}


import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.math.BigInteger;
import java.util.List;
import java.util.ArrayList;
import java.util.Queue;
import java.util.PriorityQueue;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
public class Problem510A
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        StringTokenizer dates=new StringTokenizer(in.readLine());
        String[][] matriz=new String[Byte.parseByte(dates.nextToken())][Byte.parseByte(dates.nextToken())];
        int filas=matriz.length;
        int columnas=matriz[0].length;
        int next=0;
        for(int i=0;i<filas;i++)
        {
        	if(i%2==0)
        		for(int j=0;j<columnas;j++)
        			matriz[i][j]="#";
        	else
        	{
        		for(int j=0;j<columnas;j++)
    				matriz[i][j]=".";
        		if(next==0)
        		{
        			matriz[i][columnas-1]="#";
        			next++;
        		}else
        		{
        			matriz[i][0]="#";
        			next--;
        		}
        	}
        }
        for(int i=0;i<filas;i++)
        	for(int j=0;j<columnas;j++)
        		System.out.print(matriz[i][j]);
        	System.out.println();

        out.close();
    }
}


import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.math.BigInteger;
import java.util.List;
import java.util.ArrayList;
import java.util.Queue;
import java.util.PriorityQueue;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
public class Problem510A
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        StringTokenizer dates=new StringTokenizer(in.readLine());
        String[][] matriz=new String[Byte.parseByte(dates.nextToken())][Byte.parseByte(dates.nextToken())];
        int filas=matriz.length;
        int columnas=matriz[0].length;
        int next=0;
        for(int i=0;i<filas;i++)
        {
        	if(i%2==0)
        		for(int j=0;j<columnas;j++)
        			matriz[i][j]="#";
        	else
        	{
        		for(int j=0;j<columnas;j++)
    				matriz[i][j]=".";
        		if(next==0)
        		{
        			matriz[i][columnas-1]="#";
        			next++;
        		}else
        		{
        			matriz[i][0]="#";
        			next--;
        		}
        	}
        }
        for(int i=0;i<filas;i++)
        {
        	for(int j=0;j<columnas;j++)
        		System.out.print(matriz[i][j]);
        	System.out.println();
        }

        out.close();
    }
}


import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.math.BigInteger;
import java.util.List;
import java.util.ArrayList;
import java.util.Queue;
import java.util.PriorityQueue;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
public class Problem510A
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        StringTokenizer dates=new StringTokenizer(in.readLine());
        String[][] matriz=new String[Integer.parseInt(dates.nextToken())][Integer.parseInt(dates.nextToken())];
        int filas=matriz.length;
        int columnas=matriz[0].length;
        String s="";
        int next=0;
        for(int i=0;i<filas;i++)
        {
        	if(i%2==0)
        	{
        		for(int j=0;j<columnas;j++)
            	{
        			matriz[i][j]="#";
            	}
        	}else
        	{
        		for(int j=0;j<columnas;j++)
    				matriz[i][j]=".";
        		if(next==0)
        		{
        			matriz[i][columnas-1]="#";
        			next++;
        		}else
        		{
        			matriz[i][0]="#";
        			next--;
        		}
        	}
        }
        for(int i=0;i<filas;i++)
        {
        	for(int j=0;j<columnas;j++)
        	{
        		System.out.print(matriz[i][j]);
        	}
        	System.out.println();
        }
        out.close();
    }
}


import java.util.*;
public class foxandsnake {
public static void main(String args[]){
	Scanner scan = new Scanner(System.in);
	int m = scan.nextInt(); int n = scan.nextInt();
	for(int i = 1;i<=m;i++){
		if(i%2==1){
			String fat ="";
		for(int j = 1;j<=n;j++){
			fat+="#";
			}
		System.out.println(fat);
		}
		else if(i%2==0){
			for(int a = 0;a<=n;a++){
				if(i==4*a-2){
					String darn = "";
					for(int k = 0;k<n;k++){

						if(k==n-1){
							darn+="#";
						}
						else{
							darn +=".";
						}
					}
					System.out.println(darn);
				}
				else if(i==4*a){
					String rip = "";
					for(int q = 0;q<n;q++){

						if(q==0){
							rip+="#";
						}
						else{
							rip +=".";
						}

					}
					System.out.println(rip);
					break;
				}
			}
		}

	}

}
}


import java.util.*;
public class foxandsnake {
public static void main(String args[]){
	Scanner scan = new Scanner(System.in);
	int m = scan.nextInt(); int n = scan.nextInt();
	for(int i = 1;i<=m;i++){
		if(i%2==1){
			String fat ="";
		for(int j = 1;j<=n;j++){
			fat+="#";
			}
		System.out.println(fat);
		}
		else if(i%2==0){
			for(int a = 0;a<n;a++){
				if(i==4*a-2){
					String darn = "";
					for(int k = 0;k<n;k++){

						if(k==n-1){
							darn+="#";
						}
						else{
							darn +=".";
						}
					}
					System.out.println(darn);
				}
				else if(i==4*a){
					String rip = "";
					for(int q = 0;q<n;q++){

						if(q==0){
							rip+="#";
						}
						else{
							rip +=".";
						}

					}
					System.out.println(rip);
					break;
				}
			}
		}

	}

}
}


import java.util.*;
public class foxandsnake {
public static void main(String args[]){
	Scanner scan = new Scanner(System.in);
	int m = scan.nextInt(); int n = scan.nextInt();
	for(int i = 1;i<=m;i++){
		if(i%2==1){
			String fat ="";
		for(int j = 1;j<=n;j++){
			fat+="#";
			}
		System.out.println(fat);
		}
		else if(i%2==0){
			for(int a = 0;a<=999;a++){
				if(i==4*a-2){
					String darn = "";
					for(int k = 0;k<n;k++){

						if(k==n-1){
							darn+="#";
						}
						else{
							darn +=".";
						}
					}
					System.out.println(darn);
				}
				else if(i==4*a){
					String rip = "";
					for(int q = 0;q<n;q++){

						if(q==0){
							rip+="#";
						}
						else{
							rip +=".";
						}

					}
					System.out.println(rip);
					break;
				}
			}
		}

	}

}
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner width = new Scanner(System.in);
        Scanner height = new Scanner(System.in);
        int w = width.nextInt();
        int h = height.nextInt();

        StringBuilder even = new StringBuilder();
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0 i < w; i++) {
            even.append("#");
            odd.append(".");
        }
        odd.deleteCharAt(1);

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                if (i-1%4==0)
                    System.out.println(odd.reverse().toString())
                else
                    System.out.println(odd.toString());

            }
        }

        width.close();
        height.close();
    }
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int h = in.nextInt();
        int w = in.nextInt();

        StringBuilder even = new StringBuilder("#");
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0; i < w-1; i++) {
            even.append("#");
            odd.append(".");
        }

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                if (i != h-1)
                    System.out.println(odd.reverse().toString());
            }
        }

        in.close();
    }
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int w = in.nextInt();
        int h = in.nextInt();

        StringBuilder even = new StringBuilder("#");
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0; i < w-1; i++) {
            even.append("#");
            odd.append(".");
        }

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                System.out.println(odd.reverse().toString());
            }
        }

        in.close();
    }
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int w = in.nextInt();
        int h = in.nextInt();

        StringBuilder even = new StringBuilder("#");
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0; i < w-1; i++) {
            even.append("#");
            odd.append(".");
        }

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                if (i != h-1)
                    System.out.println(odd.reverse().toString());
            }
        }

        in.close();
    }
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner width = new Scanner(System.in);
        Scanner height = new Scanner(System.in);
        int w = width.nextInt();
        int h = height.nextInt();

        StringBuilder even = new StringBuilder("#");
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0; i < w-1; i++) {
            even.append("#");
            odd.append(".");
        }

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                System.out.println(odd.reverse().toString());
            }
        }

        width.close();
        height.close();
    }
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner width = new Scanner(System.in);
        Scanner height = new Scanner(System.in);
        int w = width.nextInt();
        int h = height.nextInt();

        StringBuilder even = new StringBuilder();
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0 i < w; i++) {
            even.append("#");
            odd.append(".");
        }
        odd.deleteCharAt(1);

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                if (i-1%4==0)
                    System.out.println(odd.reverse().toString());
                else
                    System.out.println(odd.toString());

            }
        }

        width.close();
        height.close();
    }
}


import java.util.*;

public class Snake {
    public static void main(String[] args)
    {
        Scanner width = new Scanner(System.in);
        Scanner height = new Scanner(System.in);
        int w = width.nextInt();
        int h = height.nextInt();

        StringBuilder even = new StringBuilder();
        StringBuilder odd = new StringBuilder("#");
        for(int i = 0; i < w; i++) {
            even.append("#");
            odd.append(".");
        }
        odd.deleteCharAt(1);

        for(int i = 0; i < h; i++) {
            if (i%2==0) {
                System.out.println(even.toString());
            } else {
                if (i-1%4==0)
                    System.out.println(odd.reverse().toString());
                else
                    System.out.println(odd.toString());

            }
        }

        width.close();
        height.close();
    }
}


import java.util.Scanner;

public class FoxAndSnake {
     public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int f=1;
        for(int i=0;i<n;i++){

        for(int j=0;j<m;j++){
        if(i%2==0){

            System.out.print("#");
        }else{
            f++;
            if(f%2==0){
            if(j==m-1)
                System.out.print("#");
            else
                System.out.print(".");
            }else{
            if(j==0)
                System.out.print("#");
            else
                System.out.print(".");

            }

        }

        }
            System.out.println("");
        }

     }
}


import java.util.Scanner;

public class FoxAndSnake {
     public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int f=0;
        for(int i=0;i<n;i++){

        for(int j=0;j<m;j++){
        if(i%2==0){

            System.out.print("#");
        }else{
            f++;
            if(f%2==0){
            if(j==m-1)
                System.out.print("#");
            else
                System.out.print(".");
            }else{
            if(j==0)
                System.out.print("#");
            else
                System.out.print(".");

            }

        }

        }
            System.out.println("");
        }

     }
}


import java.util.Scanner;

public class FoxAndSnake {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int f = 1;
        for (int i = 0; i < n; i++) {

            for (int j = 0; j < m; j++) {

                if (i % 2 == 0) {

                    System.out.print("#");
                } else {

                    if (f % 2 == 0) {
                        if (j == (m - 1)) {
                            System.out.print("#");

                        } else {
                            System.out.print(".");
                        }

                    }

                    if (f % 2 != 0) {
                        if (j == 0) {
                            System.out.print("#");

                        } else {
                            System.out.print(".");
                        }

                    }

                }

            }
           if(i%2==0)
               f++;

            System.out.println("");
        }

    }
}


package default;

import java.util.Scanner;

public class prac1 {

	public static Scanner mySc = new Scanner(System.in);

	public static void main(String[] args) {
		int row = 0, col = 0, flag = 0;

		String msString= mySc.nextLine();
		String[] splitStr = msString.split("\\s+");

		row= Integer.parseInt(splitStr[0]);
		col= Integer.parseInt(splitStr[1]);

		for (int i = 1; i <= row; i++) {

			if (i % 2 == 1) {
				for (int x = 0; x < col; x++)
					System.out.print("#");
				System.out.println("");
			} else {
				if (flag % 2 == 0) {
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("#");
					flag++;
				} else {
					System.out.print("#");
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("");
					flag++;
				}

			}

		}

	}
}


package javaPractices;

import java.util.Scanner;

public class prac1 {

	public static Scanner mySc=new Scanner(System.in);

	public static void main(String[] args) {
		int row=0, col=0;
		int flag = 0;
		row = mySc.nextInt();
		col = mySc.nextInt();

		for (int i = 1; i <= row; i++) {

			if (i % 2 == 1) {
				for (int x = 0; x < col; x++)
					System.out.print("#");
				System.out.println("");
			} else {
				if (flag%2 == 0) {
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("#");
					flag++;
				} else {
					System.out.print("#");
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("");
					flag++;
				}

			}

		}

	}
}


package javaPractices;

import java.util.Scanner;

public class prac1 {

	public static Scanner mySc = new Scanner(System.in);

	public static void main(String[] args) {
		int row = 0, col = 0;
		int flag = 0;
		if (mySc.hasNextInt())
			row = mySc.nextInt();
		if (mySc.hasNextInt())
			col = mySc.nextInt();

		for (int i = 1; i <= row; i++) {

			if (i % 2 == 1) {
				for (int x = 0; x < col; x++)
					System.out.print("#");
				System.out.println("");
			} else {
				if (flag % 2 == 0) {
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("#");
					flag++;
				} else {
					System.out.print("#");
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("");
					flag++;
				}

			}

		}

	}
}


package javaPractices;

import java.util.Scanner;

public class prac1 {

	public static Scanner mySc = new Scanner(System.in);

	public static void main(String[] args) {
		int row = 0, col = 0;
		int flag = 0;

		String msString= mySc.nextLine();
		String[] splitStr = msString.split("\\s+");

		row= Integer.parseInt(splitStr[0]);
		col= Integer.parseInt(splitStr[1]);

		for (int i = 1; i <= row; i++) {

			if (i % 2 == 1) {
				for (int x = 0; x < col; x++)
					System.out.print("#");
				System.out.println("");
			} else {
				if (flag % 2 == 0) {
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("#");
					flag++;
				} else {
					System.out.print("#");
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("");
					flag++;
				}

			}

		}

	}
}


import java.util.Scanner;

public class prac1 {

	public static Scanner mySc = new Scanner(System.in);

	public static void main(String[] args) {
		int row = 0, col = 0, flag = 0;

		String msString= mySc.nextLine();
		String[] splitStr = msString.split("\\s+");

		row= Integer.parseInt(splitStr[0]);
		col= Integer.parseInt(splitStr[1]);

		for (int i = 1; i <= row; i++) {

			if (i % 2 == 1) {
				for (int x = 0; x < col; x++)
					System.out.print("#");
				System.out.println("");
			} else {
				if (flag % 2 == 0) {
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("#");
					flag++;
				} else {
					System.out.print("#");
					for (int x = 0; x < col - 1; x++)
						System.out.print(".");
					System.out.println("");
					flag++;
				}

			}

		}

	}
}