#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],dp[100500][305],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = 1; j < n; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (i = 1; i < k; i++)
        for (j = 1; j < k; j++)
            if (i*i+j*j == k*k)
               {
               ki = i, kj = j;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n) {out(ki,kj,-ni,-nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n) {out(kj,ki,-ni,-nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n) {out(ki,kj,-nj,-ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n) {out(kj,ki,-nj,-ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = max(1LL,(ll)sqrt(n*n-i*i)-2); j < sqrt(n*n-i*i)+2; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (ll i1 = 1; i1 < k; i1++)
        for (ll j1 = max(1LL,(ll)sqrt(k*k-i1*i1)-2); j1 < sqrt(k*k-i1*i1)+2; j1++)
            if (i1*i1+j1*j1 == k*k)
               {
               ki = i1, kj = j1;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n && kj!=nj) {out(ki,kj,-ni,nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n && ki!=nj) {out(kj,ki,-ni,nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n && kj!=ni) {out(ki,kj,-nj,ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n && ki!=ni) {out(kj,ki,-nj,ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = max(1LL,(ll)sqrt(n*n-i*i)-2); j < sqrt(n*n-i*i)+2; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (ll i1 = 1; i1 < k; i1++)
        for (ll j1 = max(1LL,(ll)sqrt(k*k-i*i)-2); j1 < sqrt(k*k-i*i)+2; j1++)
            if (i1*i1+j1*j1 == k*k)
               {
               ki = i1, kj = j1;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n && kj!=nj) {out(ki,kj,-ni,nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n && ki!=nj) {out(kj,ki,-ni,nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n && kj!=ni) {out(ki,kj,-nj,ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n && ki!=ni) {out(kj,ki,-nj,ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],dp[100500][305],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = 1; j < n; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (i = 1; i < k; i++)
        for (j = 1; j < k; j++)
            if (i*i+j*j == k*k)
               {
               ki = i, kj = j;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n) {out(ki,kj,-ni,nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n) {out(kj,ki,-ni,nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n) {out(ki,kj,-nj,ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n) {out(kj,ki,-nj,ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],dp[100500][305],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = 1; j < sqrt(n*n-i*i)+2; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (i = 1; i < k; i++)
        for (j = 1; j < sqrt(k*k-i*i)+2; j++)
            if (i*i+j*j == k*k)
               {
               ki = i, kj = j;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n && kj!=nj) {out(ki,kj,-ni,nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n && ki!=nj) {out(kj,ki,-ni,nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n && kj!=ni) {out(ki,kj,-nj,ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n && ki!=ni) {out(kj,ki,-nj,ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],dp[100500][305],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = 1; j < n; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (i = 1; i < k; i++)
        for (j = 1; j < k; j++)
            if (i*i+j*j == k*k)
               {
               ki = i, kj = j;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n && kj!=nj) {out(ki,kj,-ni,nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n && ki!=nj) {out(kj,ki,-ni,nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n && kj!=ni) {out(ki,kj,-nj,ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n && ki!=ni) {out(kj,ki,-nj,ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <cstring>
#define tr 1000000007
#define mp make_pair
#define pb push_back
#define tA 555
#define tB 666
#define AorB 777
typedef long long ll;
using namespace std;
ll a[100500],c[300],dp[100500][305],z,cnt,tmp,e,l,r,n,m,x,y,k,j,p,k1,k2,i,cur,rez;
vector <ll> f[100500];
string s[200000];
ll Abs(ll x)
{
 if (x < 0) return -x;
 return x;
}
ll dist(ll x1, ll y1, ll x2, ll y2)
{
 return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}
void out(ll x1, ll y1, ll x2, ll y2)
{
     cout << "YES" << endl;
     cout << 0 << " " << 0 << endl;
     cout << x1 << " " << y1 << endl;
     cout << x2 << " " << y2 << endl;
}
int main()
{
    cin >> n >> k;
    {
    ll ni = 0,nj = 0,ki = 0,kj = 0;
    for (i = 1; i < n; i++)
        for (j = max(1LL,(ll)sqrt(n*n-i*i)-2); j < sqrt(n*n-i*i)+2; j++)
            if (i*i+j*j == n*n)
            {
               ni = i, nj = j;
    for (i = 1; i < k; i++)
        for (j = max(1LL,(ll)sqrt(k*k-i*i)-2); j < sqrt(k*k-i*i)+2; j++)
            if (i*i+j*j == k*k)
               {
               ki = i, kj = j;
               //out(ki,kj,-ni,-nj);
               if (dist(ki,kj,-ni,nj) == k*k+n*n && kj!=nj) {out(ki,kj,-ni,nj);return 0;}
               if (dist(kj,ki,-ni,nj) == k*k+n*n && ki!=nj) {out(kj,ki,-ni,nj);return 0;}
               if (dist(ki,kj,-nj,ni) == k*k+n*n && kj!=ni) {out(ki,kj,-nj,ni);return 0;}
               if (dist(kj,ki,-nj,ni) == k*k+n*n && ki!=ni) {out(kj,ki,-nj,ni);return 0;}
               }
            }

    }
    cout << "NO" << endl;
   return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-3;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = -a+1; x < a; x++)
	{
		for (int y = -a+1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{

				int xb = floor((ld)b*cos(atan((ld)y/(ld)x) - PI / 2.0) + EPS);
				int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	for (int x = -b + 1; x < b; x++)
	{
		for (int y = -b + 1; y < b; y++)
		{
			if (x*x + y*y == b*b)
			{

				int xa = floor((ld)a*cos(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				int ya = floor((ld)a*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xa << " " << ya << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = 1; x < a; x++)
	{
		for (int y = 1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{

				int xb = floor((ld)b*cos(atan(4.0 / 3.0) - PI / 2.0) + 0.1);
				int yb = floor((ld)b*sin(atan(4.0 / 3.0) - PI / 2.0) + 0.1);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	cout << "NO"<<endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-3;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = -a+1; x < a; x++)
	{
		for (int y = -a+1; y < a; y++)
		{
			if (x*x + y*y == a*a && x!=y)
			{
				int xb = floor((ld)b*cos(atan((ld)y/(ld)x) - PI / 2.0) + EPS);
				int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	for (int x = -b + 1; x < b; x++)
	{
		for (int y = -b + 1; y < b; y++)
		{
			if (x*x + y*y == b*b && x!=y)
			{

				int xa = floor((ld)a*cos(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				int ya = floor((ld)a*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xa << " " << ya << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	bool fff = 0;
	for (int x = 1; x < a; x++)
	{
		for (int y = 1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{
				fff = 1;
			}
		}
	}
	if (!fff)
	{

		cout << "NO" << endl;
		return 0;
	}
	else
	{
		fff = 0;
		for (int x = 1; x <b; x++)
		{
			for (int y = 1; y < b; y++)
			{
				if (x*x + y*y == b*b)
				{
					fff = 1;
				}
			}
		}
		if (!fff)
		{
			cout << "NO" << endl;
			return 0;
		}
		else
		{
			cout << "YES" << endl;
			int xa, ya, xb, yb;
			cout << 0 << " " << 0 << endl;
			for (xa = 1; xa < a; xa++)
			{
				for (ya = 1; ya < a; ya++)
				{
					if (xa*xa + ya*ya == a*a)
					{
						cout << xa << " " << ya << endl;
						goto bbb;
					}
				}
			}
		bbb:;
			yb =- xa*b / a;
			xb = ya*b / a;
			cout << xb << " " << yb << endl;
			return 0;
		}
	}
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = 1; x < a; x++)
	{
		for (int y = 1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{

				if (abs(floor((ld)b*cos(atan((ld)y / (ld)x) - PI / 2.0)) - (ld)b*cos(atan((ld)y / (ld)x) - PI / 2.0)) < EPS && abs(floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0)) - (ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0)) < EPS)
				{
					int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0));
					int xb = floor((ld)b*cos(atan((ld)y / (ld)x) - PI / 2.0));
					if (xb == x)
					{
						continue;
					}
					cout << "YES" << endl;
					cout << 0 << " " << 0 << endl;
					cout << x << " " << y << endl;
					cout << xb << " " << yb << endl;
					return 0;
				}
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = 1; x < a; x++)
	{
		for (int y = 1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{

				int xb = floor((ld)b*cos(atan((ld)y / (ld)x) - PI / 2.0) + 0.1);
				int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0) + 0.1);
				if (x == xb)
				{
					continue;
				}
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = 1; x < a; x++)
	{
		for (int y = 1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{

				int xb = floor((ld)b*cos(atan((ld)y/(ld)x) - PI / 2.0) + 0.1);
				int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0) + 0.1);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-7;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	bool fff = 0;
	for (int x = 1; x < a; x++)
	{
		for (int y = 1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{
				fff = 1;
			}
		}
	}
	if (!fff)
	{

		cout << "NO" << endl;
		return 0;
	}
	else
	{
		fff = 0;
		for (int x = 1; x <b; x++)
		{
			for (int y = 1; y < b; y++)
			{
				if (x*x + y*y == b*b)
				{
					fff = 1;
				}
			}
		}
		if (!fff)
		{
			cout << "NO" << endl;
			return 0;
		}
		else
		{

			int xa, ya, xb, yb;
			int ggg = 0;
			for (xa = 1; xa < a; xa++)
			{
				for (ya = 1; ya < a; ya++)
				{
					yb = -xa*b / a;
					xb = ya*b / a;
					if (xa*xa + ya*ya == a*a && xa!=xb)
					{
						ggg = 1;
						goto bbb;
					}
				}
			}
		bbb:;
			if (!ggg)
			{
				cout << "NO";
				return 0;
			}
			else
			{

				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << xa << " " << ya << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-3;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = -a+1; x < a; x++)
	{
		for (int y = -a+1; y < a; y++)
		{
			if (x*x + y*y == a*a && abs(x) != abs(y))
			{
				int xb = floor((ld)b*cos(atan((ld)y/(ld)x) - PI / 2.0) + EPS);
				int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	for (int x = -b + 1; x < b; x++)
	{
		for (int y = -b + 1; y < b; y++)
		{
			if (x*x + y*y == b*b && abs(x)!=abs(y))
			{

				int xa = floor((ld)a*cos(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				int ya = floor((ld)a*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xa << " " << ya << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#define _CRT_SECURE_NO_DEPRECATE
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <ctime>
#include <math.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <complex>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int M = INF;
const double RRR = 180.0 / PI;
const long double EPS = 1e-3;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;

int main()
{
	double TIME_START = clock();
#ifndef ONLINE_JUDGE
	freopen("INPUT.TXT", "r", stdin);
	//freopen("OUTPUT.TXT","w",stdout);
#endif
	int a, b;
	cin >> a >> b;
	//cout << cos(atan(4.0 / 3.0)-PI/2.0);
	//return 0;
	for (int x = -a+1; x < a; x++)
	{
		for (int y = -a+1; y < a; y++)
		{
			if (x*x + y*y == a*a)
			{
				int xb = floor((ld)b*cos(atan((ld)y/(ld)x) - PI / 2.0) + EPS);
				int yb = floor((ld)b*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				if (x == xb || y == yb)
				{
					continue;
				}
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xb << " " << yb << endl;
				return 0;
			}
		}
	}
	for (int x = -b + 1; x < b; x++)
	{
		for (int y = -b + 1; y < b; y++)
		{
			if (x*x + y*y == b*b)
			{

				int xa = floor((ld)a*cos(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				int ya = floor((ld)a*sin(atan((ld)y / (ld)x) - PI / 2.0) + EPS);
				if (x == xa || y == ya)
				{
					continue;
				}
				cout << "YES" << endl;
				cout << 0 << " " << 0 << endl;
				cout << x << " " << y << endl;
				cout << xa << " " << ya << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;

}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -2001; i <= 2001; i++) {
        for (int j = -2001; j <= 2001; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && !(abs(i) == a && j == 0) && !(i == 0 && abs(j) == a)) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.0000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(l.end.x + b * a1, l.end.y + b * b1);
}

int main() {
    cin >> a >> b;
    point p(0, 0);
    for (double i = -1 * a + 1; i < a; i++) {
        for (double j = -1 * a + 1; j < a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps) {
                point p1(i, j);
                point p2 = lines(line(p1, p));
                if (abs(p2.x - (int)p2.x) < eps && abs(p2.y - (int)p2.y) < eps) {
                    cout << "YES" << endl;
                    cout << p.x << ' ' << p.y << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -1001; i <= 10001; i++) {
        for (int j = -1001; j <= 10001; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0 && j != 0) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -1001; i <= 1001; i++) {
        for (int j = -1001; j <= 1001; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && !(abs(i) == a && j == 0) && !(i == 0 && abs(j) == a)) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(l.end.x + b * a1, l.end.y + b * b1);
}

int main() {
    cin >> a >> b;
    point p(0, 0);
    for (double i = -1 * a + 1; i < a; i++) {
        for (double j = -1 * a + 1; j < a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps) {
                point p1(i, j);
                point p2 = lines(line(p1, p));
                if (abs(p2.x - int(p2.x)) < eps && abs(p2.y - int(p2.y)) < eps) {
                    cout << "YES" << endl;
                    cout << int(p.x) << ' ' << int(p.y) << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(l.end.x + b * a1, l.end.y + b * b1);
}

int main() {
    cin >> a >> b;
    point p(0, 0);
    for (double i = -1 * a + 1; i < a; i++) {
        for (double j = -1 * a + 1; j < a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps) {
                point p1(i, j);
                point p2 = lines(line(p1, p));
                if (abs(p2.x - int(p2.x)) < eps && abs(p2.y - int(p2.y)) < eps) {
                    cout << "YES" << endl;
                    cout << int(p.x) << ' ' << int(p.y) << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(l.end.x + b * a1, l.end.y + b * b1);
}

int main() {
    cin >> a >> b;
    point p(0, 0);
    for (double i = -1 * a + 1; i < a; i++) {
        for (double j = -1 * a + 1; j < a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps) {
                point p1(i, j);
                point p2 = lines(line(p1, p));
                if (!(abs(p2.x - int(p2.x)) > 0.0 || abs(p2.y - int(p2.y)) > 0.0)) {
                    cout << "YES" << endl;
                    cout << int(p.x) << ' ' << int(p.y) << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(b * a1, b * b1);
}

int main() {
    cin >> a >> b;
    for (double i = -1 * a; i <= a; i++) {
        for (double j = -1 * a; j <= a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0.0 && j != 0.0) {
                point p1(i, j);
                point p2 = lines(line(p1, point(0, 0)));
                if (!(abs(p2.x - int(p2.x)) > 0.0 || abs(p2.y - int(p2.y)) > 0.0)) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.0000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(l.end.x + b * a1, l.end.y + b * b1);
}

int main() {
    cin >> a >> b;
    point p(0, 0);
    for (double i = 0; i < a; i++) {
        for (double j = 0; j < a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps) {
                point p1(i, j);
                point p2 = lines(line(p1, p));
                if (abs(p2.x - (int)p2.x) < eps && abs(p2.y - (int)p2.y) < eps) {
                    cout << "YES" << endl;
                    cout << p.x << ' ' << p.y << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -1 * a; i <= a; i++) {
        for (int j = -1 * a; j <= a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0 && j != 0) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;//
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -2001; i <= 2001; i++) {
        for (int j = -2001; j <= 2001; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && !(abs(i) == a && j == 0) && !(i == 0 && abs(j) == a)) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;//
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -2001; i <= 2001; i++) {
        for (int j = -2001; j <= 2001; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && !(abs(i) == a && j == 0) && !(i == 0 && abs(j) == a)) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000 && p2.x != p1.x && p2.y != p1.y && p2.x != 0 && p2.y != 0) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -1 * a; i <= a; i++) {
        for (int j = -1 * a; j <= a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0 && j != 0) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(l.end.x + b * a1, l.end.y + b * b1);
}

int main() {
    cin >> a >> b;
    point p(0, 0);
    for (double i = -1 * a + 1; i < a; i++) {
        for (double j = -1 * a + 1; j < a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0 && j != 0) {
                point p1(i, j);
                point p2 = lines(line(p1, p));
                if (!(abs(p2.x - int(p2.x)) > 0.0 || abs(p2.y - int(p2.y)) > 0.0)) {
                    cout << "YES" << endl;
                    cout << int(p.x) << ' ' << int(p.y) << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    return point(b * a1, b * b1);
}

int main() {
    cin >> a >> b;
    for (double i = -1 * a; i <= a; i++) {
        for (double j = -1 * a; j <= a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0.0 && j != 0.0) {
                point p1(i, j);
                point p2 = lines(p1);
                if (!(abs(p2.x - int(p2.x)) > 0.0 || abs(p2.y - int(p2.y)) > 0.0)) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.000001

struct point{
    double x, y;
    point(){}
    point(double _x, double _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

double a, b;

point lines(line l) {
    double a1, b1, c;
    a1 = l.end.y - l.begin.y;
    b1 = l.begin.x  - l.end.x;
    double d = sqrt(a1 * a1 + b1 * b1);
    a1 /= d;
    b1 /= d;
    c = -(a1 * l.begin.x + b1 * l.begin.y);
    return point(b * a1, b * b1);
}

int main() {
    cin >> a >> b;
    for (double i = -1 * a; i <= a; i++) {
        for (double j = -1 * a; j <= a; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && i != 0.0 && j != 0.0) {
                point p1(i, j);
                point p2 = lines(line(p1, point(0, 0)));
                if (!(abs(p2.x - int(p2.x)) > 0.0 || abs(p2.y - int(p2.y)) > 0.0)) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << int(p1.x) << ' ' << int(p1.y) << endl;
                    cout << int(p2.x) << ' ' << int(p2.y) << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>

using namespace std;

#define eps 0.00000001

struct point{
    int x, y;
    point(){}
    point(int _x, int _y) {
        x = _x;
        y = _y;
    }
};

struct line{
    point begin, end;
    line(){}
    line(point _begin, point _end) {
        begin = _begin;
        end = _end;;
    }
};

int a, b;

point lines(point l) {
    double a1, b1;
    a1 = -l.y;
    b1 = l.x;
    double d = a;
    a1 /= d;
    b1 /= d;
    if (abs(b * a1 - int(b * a1)) >= eps || abs(b * b1 - int(b * b1)) >= eps) {
        return point(1000000, 1000000);
    }
    return point(int(b * a1), int(b * b1));
}

int main() {
    cin >> a >> b;
    for (int i = -1001; i <= 1001; i++) {
        for (int j = -1001; j <= 1001; j++) {
            if (abs(sqrt(i * i + j * j) - a) < eps && !(i == a && j == 0) && !(i == 0 && j == a)) {
                point p1(i, j);
                point p2 = lines(p1);
                if (p2.x != 1000000) {
                    cout << "YES" << endl;
                    cout << 0 << ' ' << 0 << endl;
                    cout << p1.x << ' ' << p1.y << endl;
                    cout << p2.x << ' ' << p2.y << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int a,b,i1,J1,t;
main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a*a;i++)
	for(int j=i;j*j<=a*a-i*i;j++)
	if(i*i+j*j==a*a)
	{
		for(int i1=1;i1*i1<=b*b;i1++)
		for(int J1=i1;J1*J1<=b*b-i1*i1;J1++)
		if(i1*i1+J1*J1==b*b)
		{

			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
}


#include<iostream>
#include<cmath>
using namespace std;
int a,b,i1,J1,t;
main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a*a;i++)
	for(int j=1;j*j<=a*a;j++)
	if(i*i+j*j==a*a)
	{
		for(int i1=1;i1*i1<=b*b;i1++)
		for(int J1=1;J1*J1<=b*b;J1++)
		if(i1*i1+J1*J1==b*b)
		{

			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
}


#include<iostream>
#include<cmath>
using namespace std;
int a,b,i1,J1,t;
main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a*a;i++)
	for(int j=i;j*j<=a*a-i*i;j++)
	if(i*i+j*j==a*a)
	{
		for(int i1=1;i1*i1<=b*b;i1++)
		for(int J1=i1;J1*J1<=b*b-i1*i1;J1++)
		if(i1*i1+J1*J1==b*b)
		{

			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
		}
	}
	cout<<"NO"<<endl;
}


#include<iostream>
#include<cmath>
using namespace std;
int a,b,i1,J1,t;
main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a*a;i++)
	for(int j=i;j*j<=a*a-i*i;j++)
	if(i*i+j*j==a*a)
	{
		for(int i1=1;i1*i1<=b*b;i1++)
		for(int J1=i1;J1*J1<=b*b-i1*i1;J1++)
		if(i1*i1+J1*J1==b*b)
		{

			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b && i!=i1)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
}


#include<iostream>
#include<cmath>
using namespace std;
int a,b,i1,J1,t;
main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a*a;i++)
	for(int j=1;j*j<=a*a;j++)
	if(i*i+j*j==a*a)
	{
		for(int i1=1;i1*i1<=b*b;i1++)
		for(int J1=1;J1*J1<=b*b;J1++)
		if(i1*i1+J1*J1==b*b)
		{

			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<-i1<<" "<<
				J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
}


#include<iostream>
using namespace std;
int a,b,i1,j1,t;main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a;i++)
	for(int j=1;j*j<=a-i*i;j++)
	if(i*i+j*j==a)
	t=1,i1=i,j1=j;

	if(t!=1)
	{cout<<"NO"<<endl;
	return 0;
	}

	for(int i=1;i*i<=b;i++)
	for(int j=1;j*j<=b-i*i;j++)
	if(i*i+j*j==b)
	{
		t=2;
		cout<<"YES"<<endl;
		cout<<0<<" "<<0<<endl;
		cout<<i1<<" "<<j1<<endl;
		cout<<i<<" "<<j<<endl;
		return 0;
	}

	if(t!=2)
	{cout<<"NO"<<endl;
	return 0;
	}

}


#include<iostream>
#include<cmath>
using namespace std;
int a,b,i1,J1,t;
main()
{
	cin>>a>>b;

	for(int i=1;i*i<=a*a;i++)
	for(int j=i;j*j<=a*a;j++)
	if(i*i+j*j==a*a)
	{
		for(int i1=1;i1*i1<=b*b;i1++)
		for(int J1=i1;J1*J1<=b*b;J1++)
		if(i1*i1+J1*J1==b*b)
		{

			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i1,J1);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
			swap(i,j);
			if(abs(i-i1)*abs(i-i1)+abs(j+J1)*abs(j+J1)==a*a+b*b)
			{
				cout<<"YES"<<endl;
				cout<<0<<" "<<0<<endl;
				cout<<i<<" "<<j<<endl;
				cout<<i1<<" "<<-J1<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
}


#include<cstdio>
int main()
{
    int a,b;
    int sign=0;
    int hh=0;
    int x1,x2,x3,y1,y2,y3;
    scanf("%d%d",&a,&b);
    for(int i=1;i<a;i++)
        for(int j=1;j<a;j++)
        if(i*i+j*j==a*a)
    {
        sign=1;
        x1=0;y1=i;x2=j;y2=0;
        break;
    }
    for(int i=1;i<b;i++)
        for(int j=1;j<b;j++)
        if(i*i+j*j==b*b)
    {
        hh=1;
        x3=x2+i;
        y3=y2+j;
        if(y3==y1)
        {
            x3=x2+j;
            y3=y2+i;
        }
        break;
    }
    if(hh==0&&sign==0)
        printf("NO");
    else
    {
        printf("YES\n");
        printf("%d %d\n",x1,y1);
         printf("%d %d\n",x2,y2);
          printf("%d %d\n",x3,y3);
    }
    return 0;
};


#include<cstdio>
int main()
{
    int a,b;
    int sign=0;
    int hh=0;
    int x1,x2,x3,y1,y2,y3;
    scanf("%d%d",&a,&b);
    for(int i=1;i<a;i++)
        for(int j=1;j<a;j++)
        if(i*i+j*j==a*a)
    {
        sign=1;
        x1=0;y1=i;x2=j;y2=0;
        break;
    }
    for(int i=1;i<b;i++)
        for(int j=1;j<b;j++)
        if(i*i+j*j==b*b)
    {
        hh=1;
        x3=x2+i;
        y3=y2+j;
        if(y3==y1)
        {
            x3=x2+j;
            y3=y2+i;
        }
        break;
    }
    if(hh==0||sign==0)
        printf("NO");
    else
    {
        printf("YES\n");
        printf("%d %d\n",x1,y1);
         printf("%d %d\n",x2,y2);
          printf("%d %d\n",x3,y3);
    }
    return 0;
};


#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

int main()
{
    int a,b;
    scanf("%d %d",&a,&b) ;
    for(int i = 1 ; i < a ; i++)
    {
        double t = sqrt(a*a-i*i);
        if(t-(int)t==0)
        {
            double ta = -1*(b*t)/a;
            double tb = (b*i)/a;
            if(ta-(int)ta==0 && tb-(int)tb==0 && tb!=t)
            {
                printf("YES\n0 0\n%d %.0lf\n%.0lf %.0lf\n",i,t,ta,tb) ;
                return 0;
            }
        }
    }
   printf("NO\n") ;
    return 0;
}


#include<cstdio>
int main()
{
    int a,b,x1,x2,x3,y1,y2,y3;
    scanf("%d%d",&a,&b);
    int num=0;
    int f=0;
    int sum=0;
    int h=0;
    int qqx[2010];
    int qqy[2010],wwx[2010],wwy[2010];
    for(int i=1;i<a;i++)
        for(int j=1;j<a;j++)
        if(i*i+j*j==a*a)
    {
        f=1;
        qqx[num]=i;
        qqy[num]=j;
        num++;
        if(i!=j)
        {
            qqx[num]=j;
            qqy[num]=i;
            num++;
        }

    }
    for(int i=1;i<b;i++)
        for(int j=1;j<b;j++)
        if(i*i+j*j==b*b)
    {
        h=1;
        wwx[sum]=i;
        wwy[sum]=j;
        sum++;
        if(i!=j)
        {
            wwx[sum]=j;
            wwy[sum]=i;
            sum++;
        }

    }
    if(f==0||h==0)
    {
        printf("NO");
        return 0;
    }

    for(int i=0;i<num;i++)
        for(int j=0;j<sum;j++)
    {
        //printf("hhhh\n");
        x1=0;y1=qqy[i];x2=qqx[i];y2=0;x3=wwx[j]+x2;y3=wwy[j];
        if((x3*x3+(y3-y1)*(y3-y1)==(a*a+b*b))&&(y1!=y3))
        {
             printf("YES\n");
            printf("%d %d\n",x1,y1);
             printf("%d %d\n",x2,y2);
              printf("%d %d\n",x3,y3);
              return 0;
        }
    }
    printf("NO");
    return 0;
};


#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
	int a, b, i, j, k;
	scanf("%d%d", &a, &b);
	for(i = 1; 4 * i + 1 <= a; i++)
		if(a % (4 * i + 1) == 0)break;
	if(4 * i + 1 > a)puts("NO");
	else{
		for(i = 1; 4 * i + 1 <= b; i++)
			if(b % (4 * i + 1) == 0)break;
		if(4 * i + 1 > b)puts("NO");
		else{
			puts("YES");
			printf("0 0\n");
			for(j = 1; j < a; j++){
				int sum = a * a - j * j;
				int temp = (int)sqrt(sum);
				if(temp * temp == sum){
					printf("%d %d\n", -j, temp);
					break;
				}
			}
			for(j = 1; j < b; j++){
				int sum = b * b - j * j;
				int temp = (int)sqrt(sum);
				if(temp * temp == sum){
					printf("%d %d\n", temp, j);
					break;
				}
			}
		}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
	int a, b, i, j, k;
	scanf("%d%d", &a, &b);
	for(i = 1; 4 * i + 1 <= a; i++)
		if(a % (4 * i + 1) == 0)break;
	if(4 * i + 1 > a)puts("NO");
	else{
		for(i = 1; 4 * i + 1 <= b; i++)
			if(b % (4 * i + 1) == 0)break;
		if(4 * i + 1 > b)puts("NO");
		else{
			puts("YES");
			printf("0 0\n");
			for(j = 1; j < a; j++){
				int sum = a * a - j * j;
				int temp = (int)sqrt(sum);
				if(temp * temp == sum){
					printf("%d %d\n", -j, -temp);
					break;
				}
			}
			for(j = 1; j < b; j++){
				int sum = b * b - j * j;
				int temp = (int)sqrt(sum);
				if(temp * temp == sum){
					printf("%d %d\n", temp, j);
					break;
				}
			}
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int ans[4],cnt=-2;
bool work(int x)
{
    cnt+=2;
    bool flag=0;
    for(int i=1;i<x;i++)
    {
        int y=x*x-i*i;
        //printf("%d %d %d\n",x,i,y);
        int j=floor((sqrt(y*1.0))+0.5);
        if(j*j==y)
        {
            ans[cnt]=i;
            ans[cnt+1]=j;
            flag=1;
            break;
        }
    }
    return flag;
}

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(work(a)&&work(b)&& ans[1]*ans[2]==ans[0]*ans[3] &&ans[1]!=ans[2])
    {
        printf("YES\n");
        printf("0 0\n%d %d\n%d %d\n",ans[0],ans[1],-ans[3],ans[2]);
    }
    else
        printf("NO\n");

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int inf = 0x3f3f3f3f, maxn = 128;
const double eps = 1e-8;

inline bool cmp(double a,double b)
{
	return fabs(a-b) < eps;
}
inline bool isInt(double d)
{
	return cmp(d,int(d+0.5));
}
inline int rnd(double d)
{
	return int(d+0.5);
}
int main()
{
	double a,b;
	cin >> a >> b;
	for(int xa = -rnd(a); xa <= rnd(a); ++xa) {
		double tya = sqrt(double(a*a - xa*xa));
		if(!isInt(tya)) {
			continue;
		}
		int ya = rnd(tya);
		double txb = -(b * ya / a);
		double tyb = (b * xa / a);
		if(!isInt(txb) || !isInt(tyb)) {
			continue;
		}
		int xb = rnd(txb), yb = rnd(tyb);
		if(!xa || !xb || !ya || !yb || (xa == xb) || (ya == yb))
			continue;
		cout << "YES" << endl;
		cout << 0 << " " << 0 << endl;
		cout << xa << " " << ya << endl;
		cout << xb << " " << yb << endl;
		return 0;
	}
	cout << "NO" << endl;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int inf = 0x3f3f3f3f, maxn = 128;
const double eps = 1e-8;

inline bool cmp(double a,double b)
{
	return fabs(a-b) < eps;
}
inline bool isInt(double d)
{
	return cmp(d,int(d+0.5));
}
inline int rnd(double d)
{
	return int(d+0.5);
}
int main()
{
	double a,b;
	cin >> a >> b;
	for(int xa = -a; xa <= a; ++xa) {
		double tya = sqrt(double(a*a - xa*xa));
		if(!isInt(tya)) {
			continue;
		}
		int ya = rnd(tya);
		double txb = (b * ya / a);
		double tyb = (b * xa / a);
		if(!isInt(txb) || !isInt(tyb)) {
			continue;
		}
		int xb = rnd(txb), yb = rnd(tyb);
		if(!xa || !xb || !ya || !yb)
			continue;
		cout << "YES" << endl;
		cout << 0 << " " << 0 << endl;
		cout << xa << " " << ya << endl;
		cout << xb << " " << yb << endl;
		return 0;
	}
	cout << "NO" << endl;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int ans[2];
bool work(int x)
{
    bool flag=0;
    for(int i=1;i<x;i++)
    {
        int y=x*x-i*i;
        //printf("%d %d %d\n",x,i,y);
        int j=round(sqrt(y*1.0));
        if(j*j==y)
        {
            ans[0]=i;
            ans[1]=j;
            flag=1;
            break;
        }
    }
    return flag;
}

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b)
    {
        int tep=a;
        a=b;
        b=tep;
    }
    if(b%a==0&&work(a))
    {
        printf("YES\n");
        printf("0 0\n%d %d\n%d %d\n",ans[0],ans[1],-ans[1]*b/a,ans[0]*b/a);
    }
    else
        printf("NO\n");

    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int inf = 0x3f3f3f3f, maxn = 128;
const double eps = 1e-8;

inline bool cmp(double a,double b)
{
	return fabs(a-b) < eps;
}
inline bool isInt(double d)
{
	return cmp(d,int(d+0.5));
}
inline int rnd(double d)
{
	return int(d+0.5);
}
int main()
{
	double a,b;
	cin >> a >> b;
	for(int xa = -a; xa <= a; ++xa) {
		double tya = sqrt(double(a*a - xa*xa));
		if(!isInt(tya)) {
			continue;
		}
		int ya = rnd(tya);
		double txb = (b * ya / a);
		double tyb = (b * xa / a);
		if(!isInt(txb) || !isInt(tyb)) {
			continue;
		}
		int xb = rnd(txb), yb = rnd(tyb);
		if(!xa || !xb || !ya || !yb || (xa == ya) || (xb == yb))
			continue;
		cout << "YES" << endl;
		cout << 0 << " " << 0 << endl;
		cout << xa << " " << ya << endl;
		cout << xb << " " << yb << endl;
		return 0;
	}
	cout << "NO" << endl;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int ans[4],cnt=-2;
bool work(int x)
{
    cnt+=2;
    bool flag=0;
    for(int i=1;i<x;i++)
    {
        int y=x*x-i*i;
        //printf("%d %d %d\n",x,i,y);
        int j=floor((sqrt(y*1.0))+0.5);
        if(j*j==y)
        {
            ans[cnt]=i;
            ans[cnt+1]=j;
            flag=1;
            break;
        }
    }
    return flag;
}

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(work(a)&&work(b)&& ans[1]*ans[2]==ans[0]*ans[3] &&(ans[1]!=ans[2]||ans[0]!=ans[3]))
    {
        printf("YES\n");
        printf("0 0\n%d %d\n%d %d\n",ans[0],ans[1],-ans[3],ans[2]);
    }
    else
        printf("NO\n");

    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1005;
int a,b;
int len1,len2;
typedef struct node
{
	int x;
	int y;
}Point;
Point p1,p2,p3;
int main()
{
	p1.x=p1.y=0;
	scanf("%d%d",&a,&b);
	bool flag=false;
	for(int i=1;i<a;i++)
	{
		int x=sqrt(a*a-i*i);
		if(x*x+i*i==a*a)
		{
			flag=true;
			break;
		}
	}
	if(!flag)
		printf("NO\n");
	else{
	for(int i=1;i<b;i++)
	{
		int x=sqrt(b*b-i*i);
		if(x*x+i*i==b*b)
		{
			flag=true;
			len1=i;
			len2=x;
			break;
		}
	}
	if(!flag)
		printf("NO\n");
	else
	{
		int i;
		for( i=1;i<a;i++)
		{
			int x=sqrt(a*a-i*i);
			if(x*x+i*i!=a*a) continue;
			int j=x;
			p2.x=i;
			p2.y=j;
			p3.x=p2.x+len1;
			p3.y=p2.y-len2;
			if(p1.x-p3.x==0||p1.y-p3.y==0) continue;

			printf("YES\n");
			printf("%d %d\n",p1.x,p1.y);
			printf("%d %d\n",p2.x,p2.y);
			printf("%d %d\n",p3.x,p3.y);
			break;

		}
		if(i==a) printf("NO\n");
	}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int ans[2];
bool work(int x)
{
    bool flag=0;
    for(int i=1;i<x;i++)
    {
        int y=x*x-i*i;
        //printf("%d %d %d\n",x,i,y);
        int j=floor((sqrt(y*1.0))+0.5);
        if(j*j==y)
        {
            ans[0]=i;
            ans[1]=j;
            flag=1;
            break;
        }
    }
    return flag;
}

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b)
    {
        int tep=a;
        a=b;
        b=tep;
    }
    if(b%a==0&&work(a)&&ans[0]*b!=ans[1]*a)
    {
        printf("YES\n");
        printf("0 0\n%d %d\n%d %d\n",ans[0],ans[1],-ans[1]*b/a,ans[0]*b/a);
    }
    else
        printf("NO\n");

    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int mapa[1000][2],mapb[1000][2],na=0,nb=0;

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);

    for(int i=1;2*i*i<=a*a;i++)
    {
        int y=a*a-i*i;
        int j=floor((sqrt(y*1.0))+0.5);
        if(j*j==y)
        {
            //printf("%d %d\n",i,j);
            mapa[++na][0]=i;
            mapa[na][1]=j;
        }
    }
    for(int i=1;2*i*i<=b*b;i++)
    {
        int y=b*b-i*i;
        int j=floor((sqrt(y*1.0))+0.5);
        if(j*j==y)
        {
            mapb[++nb][0]=i;
            mapb[nb][1]=j;
        }
    }
    for(int i=1;i<=na;i++)
        for(int j=1;j<=nb;j++)
            if(mapa[i][0]*mapb[j][1]==mapa[i][1]*mapb[j][0])
            {
                if(mapa[i][0]!=mapb[j][1])
                {
                    printf("YES\n0 0\n%d %d\n%d %d\n",mapa[i][0],mapa[i][1],mapb[j][1],-mapb[j][0]);
                    return 0;
                }
                if(mapa[i][1]!=mapb[j][0]);
                {
                    printf("YES\n0 0\n%d %d\n%d %d\n",mapa[i][0],mapa[i][1],-mapb[j][1],mapb[j][0]);
                    return 0;
                }
            }
    printf("NO\n");
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int inf = 0x3f3f3f3f, maxn = 128;
const double eps = 1e-8;

inline bool cmp(double a,double b)
{
	return fabs(a-b) < eps;
}
inline bool isInt(double d)
{
	return cmp(d,int(d+0.5));
}
inline int rnd(double d)
{
	return int(d+0.5);
}
int main()
{
	double a,b;
	cin >> a >> b;
	for(int xa = -a; xa <= a; ++xa) {
		double tya = sqrt(double(a*a - xa*xa));
		if(!isInt(tya)) {
			continue;
		}
		int ya = rnd(tya);
		double txb = (b * ya / a);
		double tyb = (b * xa / a);
		if(!isInt(txb) || !isInt(tyb)) {
			continue;
		}
		int xb = rnd(txb), yb = rnd(tyb);
		if(!xa || !xb || !ya || !yb || (xa == xb) || (ya == yb))
			continue;
		cout << "YES" << endl;
		cout << 0 << " " << 0 << endl;
		cout << xa << " " << ya << endl;
		cout << xb << " " << yb << endl;
		return 0;
	}
	cout << "NO" << endl;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1005;
int a,b;
int ppp;
int len1,len2;
typedef struct node
{
	int x;
	int y;
}Point;
Point p1,p2,p3;
int main()
{
	p1.x=p1.y=0;
	scanf("%d%d",&a,&b);
	bool flag=false;
	for(int i=1;i<a;i++)
	{
		int x=sqrt(a*a-i*i);
		if(x*x+i*i==a*a)
		{
			flag=true;
			break;
		}
	}
	if(!flag)
		printf("NO\n");
	else{
	for(int i=1;i<b;i++)
	{
		int x=sqrt(b*b-i*i);
		if(x*x+i*i==b*b)
		{
			flag=true;
			len1=i;
			len2=x;
			break;
		}
	}
	if(!flag)
		printf("NO\n");
	else
	{
		int i;
		for( i=1;i<a;i++)
		{
			int x=sqrt(a*a-i*i);
			if(x*x+i*i!=a*a) continue;
			int j=x;
			p2.x=i;
			p2.y=j;
			p3.x=p2.x+len1;
			p3.y=p2.y-len2;
			if(p1.x-p3.x==0||p1.y-p3.y==0) continue;

			printf("YES\n");
			printf("%d %d\n",p1.x,p1.y);
			printf("%d %d\n",p2.x,p2.y);
			printf("%d %d\n",p3.x,p3.y);
			break;

		}
		if(i==a) printf("NO\n");
	}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1005;
double a,b;
int len1,len2;
typedef struct node
{
	int x;
	int y;
}Point;
Point p1,p2,p3,p4,p5,p6;
int main()
{
	p1.x=p1.y=0;
	scanf("%lf%lf",&a,&b);
	bool flag=false;
	for(double i=1;i<a;i=i+1.0)
	{
		double x;
		x=sqrt(a*a-i*i);
		int t=(int)x;
		double l=(double)t;
		if(l==x)
		{
			flag=true;
			len1=(int )i;
			len2=(int )x;
			p2.x=p1.x+len1;
			p2.y=p1.y+len2;
			break;
		}
	}
	if(!flag)
		printf("NO\n");
	else
	{
	for(double i=1;i<b;i=i+1.0)
	{
		double x;
		x=sqrt(b*b-i*i);
		int t=(int)x;
		double l=(double)t;
		if(l==x)
		{
			flag=true;
			len1=(int )i;
			len2=(int )x;
			p3.x=p2.x+len1;
			p3.y=p2.y-len2;
			break;
		}
	}
	if(!flag) printf("NO\n");
	else
	{
		int i;
		for( i=1;i<a;i++)
		{
			double m=sqrt(a*a-double(i*i));
			if(m-double(int(m))!=0) continue;
			int j=(int)m;
			p2.x=i;
			p2.y=j;
			p3.x=p2.x+len1;
			p3.y=p2.y-len2;
			if(p1.x-p3.x==0||p1.y-p3.y==0) continue;

			printf("YES\n");
			printf("%d %d\n",p1.x,p1.y);
			printf("%d %d\n",p2.x,p2.y);
			printf("%d %d\n",p3.x,p3.y);
			break;

		}
		if(i==a) printf("NO\n");
	}
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int inf = 0x3f3f3f3f, maxn = 128;
const double eps = 1e-8;

inline bool cmp(double a,double b)
{
	return fabs(a-b) < eps;
}
inline bool isInt(double d)
{
	return cmp(d,round(d));
}

int main()
{
	double a,b;
	cin >> a >> b;
	for(int xa = -round(a); xa <= round(a); ++xa) {
		double tya = sqrt(double(a*a - xa*xa));
		if(!isInt(tya)) {
			continue;
		}
		int ya = round(tya);
		double txb = -(b * ya / a);
		double tyb = (b * xa / a);
		if(!isInt(txb) || !isInt(tyb)) {
			continue;
		}
		int xb = round(txb), yb = round(tyb);
		if(!xa || !xb || !ya || !yb || (xa == xb) || (ya == yb))
			continue;
		cout << "YES" << endl;
		cout << 0 << " " << 0 << endl;
		cout << xa << " " << ya << endl;
		cout << xb << " " << yb << endl;
		return 0;
	}
	cout << "NO" << endl;
}


#include<cstdio>
#include<cstring>
#include<cmath>
int ans[2];
bool work(int x)
{
    bool flag=0;
    for(int i=1;i<x;i++)
    {
        int y=x*x-i*i;
        //printf("%d %d %d\n",x,i,y);
        int j=floor((sqrt(y*1.0))+0.5);
        if(j*j==y)
        {
            ans[0]=i;
            ans[1]=j;
            flag=1;
            break;
        }
    }
    return flag;
}

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b)
    {
        int tep=a;
        a=b;
        b=tep;
    }
    if(b%a==0&&work(a))
    {
        printf("YES\n");
        printf("0 0\n%d %d\n%d %d\n",ans[0],ans[1],-ans[1]*b/a,ans[0]*b/a);
    }
    else
        printf("NO\n");

    return 0;
}


/*
Author :: MD. Musfiqur Rahman Sanim
Aust cse 28th Batch
ID:11.02.04.097
*/

//{ Template
using namespace std;
//{ C-headers
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <cctype>
#include <cassert>
#include <ctime>
//}
//{ C++-headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
//}
//{ Loops
#define forab(i,a,b) for (__typeof(b) i = (a); i <= (b); ++i)
#define rep(i,n) forab (i, 0, (n) - 1)
#define For(i,n) forab (i, 1, n)
#define rofba(i,a,b) for (__typeof(b) i = (b); i >= (a); --i)
#define per(i,n) rofba (i, 0, (n) - 1)
#define rof(i,n) rofba (i, 1, n)
#define forstl(i,s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
//}
//{ Floating-points
#define EPS 1e-7
#define abs(x) (((x) < 0) ? - (x) : (x))
#define zero(x) (abs (x) < EPS)
#define equal(a,b) (zero ((a) - (b)))
#define PI 2*acos (0.0)
//}
typedef long long int64;
typedef unsigned long long int64u;
#define memo(a,v) memset(a,v,sizeof(a))
#define all(a) a.begin(),a.end()
#define db double
#define pb push_back
#define pii pair<int ,int >
#define pdd pair<db ,db >
#define NL puts("")
//{
//Intput_Output
#define II ({ int a; scanf("%d",&a); a;})
#define IL ({ int64 a; scanf("%lld",&a);  a;})
#define ID ({ db a; scanf("%lf",&a);  a;})
#define IC ({ char a; scanf("%c",&a);  a;})
#define IS ({ string a; cin >> a;  a;})
#define ICA(n) ({ char a[n]; scanf("%s",&a);  a;})
#define OC printf("Case %d:",cs);
//}
//}
template <class T, class U> inline T max (T &a, U &b) {
    return a > b ? a : b;
}
template <class T, class U> inline T min (T &a, U &b) {
    return a < b ? a : b;
}
template <class T, class U> inline T swap (T &a, U &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

const int64 INF = (1ll)<<50;
const int mx = 1e5 + 7;
const int mod = 1000000007 ;
const db pi = PI;
int EQ(double d) {
    if ( fabs(d) < EPS ) return 0;
    return d > EPS ? 1 : -1 ;
}

int64 arr[1010];
void call() {
    cout << "NO" << endl;
    exit(0);
}
int main() {
#ifdef Sanim
    freopen ("in.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#endif
    cout << setprecision(10) << fixed;
    int64 a,b;
    For(i,1000) {
        arr[i] = i*i;
    }
    while(cin >> a >> b ) {
        a *= a;
        b *= b;

        int c = -1,d = -1,e = -1,f = -1;
        For(i,1000) {
            if(arr[i] > a) break;
            int64 tmp = a - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    c = i;
                    d = j;
                    break;
                }
            }
           // if(c!=-1) break;
        }

        For(i,1000) {
            if(arr[i] > b) break;
            int64 tmp = b - arr[i];
            For(j,1000) {
                if(tmp == arr[j] && j!=d) {
                    e = i;
                    f = j;
                    break;
                }
            }
            //if(e!=-1) break;
        }

        if(c == -1 || e == -1) {
            call();
        } else {
            pii p1 = pii(-2,-2);
            pii p2 = pii(p1.first+c,p1.second+d);
            pii p3 = pii(p1.first-e,p1.second+f);
            cout << "YES" << endl;
            cout << p1.first << " " << p1.second << endl;
            cout << p2.first << " " << p2.second << endl;
            cout << p3.first << " " << p3.second << endl;
        }

    }

}


/*
Author :: MD. Musfiqur Rahman Sanim
Aust cse 28th Batch
ID:11.02.04.097
*/

//{ Template
using namespace std;
//{ C-headers
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <cctype>
#include <cassert>
#include <ctime>
//}
//{ C++-headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
//}
//{ Loops
#define forab(i,a,b) for (__typeof(b) i = (a); i <= (b); ++i)
#define rep(i,n) forab (i, 0, (n) - 1)
#define For(i,n) forab (i, 1, n)
#define rofba(i,a,b) for (__typeof(b) i = (b); i >= (a); --i)
#define per(i,n) rofba (i, 0, (n) - 1)
#define rof(i,n) rofba (i, 1, n)
#define forstl(i,s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
//}
//{ Floating-points
#define EPS 1e-7
#define abs(x) (((x) < 0) ? - (x) : (x))
#define zero(x) (abs (x) < EPS)
#define equal(a,b) (zero ((a) - (b)))
#define PI 2*acos (0.0)
//}
typedef long long int64;
typedef unsigned long long int64u;
#define memo(a,v) memset(a,v,sizeof(a))
#define all(a) a.begin(),a.end()
#define db double
#define pb push_back
#define pii pair<int ,int >
#define pdd pair<db ,db >
#define NL puts("")
//{
//Intput_Output
#define II ({ int a; scanf("%d",&a); a;})
#define IL ({ int64 a; scanf("%lld",&a);  a;})
#define ID ({ db a; scanf("%lf",&a);  a;})
#define IC ({ char a; scanf("%c",&a);  a;})
#define IS ({ string a; cin >> a;  a;})
#define ICA(n) ({ char a[n]; scanf("%s",&a);  a;})
#define OC printf("Case %d:",cs);
//}
//}
template <class T, class U> inline T max (T &a, U &b) {
    return a > b ? a : b;
}
template <class T, class U> inline T min (T &a, U &b) {
    return a < b ? a : b;
}
template <class T, class U> inline T swap (T &a, U &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

const int64 INF = (1ll)<<50;
const int mx = 1e5 + 7;
const int mod = 1000000007 ;
const db pi = PI;
int EQ(double d) {
    if ( fabs(d) < EPS ) return 0;
    return d > EPS ? 1 : -1 ;
}

int64 arr[1010];
void call() {
    cout << "NO" << endl;
    exit(0);
}
int main() {
#ifdef Sanim
    freopen ("in.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#endif
    cout << setprecision(10) << fixed;
    int64 a,b;
    For(i,1000) {
        arr[i] = i*i;
    }
    while(cin >> a >> b ) {
        a *= a;
        b *= b;

        int c = -1,d = -1,e = -1,f = -1;
        For(i,1000) {
            if(arr[i] >= a) break;
            int64 tmp = a - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    c = i;
                    d = j;
                    break;
                }
            }
            if(c!=-1) break;
        }

        For(i,1000) {
            if(arr[i] >= b) break;
            int64 tmp = b - arr[i];
            For(j,1000) {
                if(tmp == arr[j] && j!=d) {
                    e = i;
                    f = j;
                    break;
                }
            }
            //if(e!=-1) break;
        }

        if(c == -1 || e == -1) {
            call();
        } else {
            pii p1 = pii(-2,-2);
            pii p2 = pii(p1.first+c,p1.second+d);
            pii p3 = pii(p1.first-e,p1.second+f);
            cout << "YES" << endl;
            cout << p1.first << " " << p1.second << endl;
            cout << p2.first << " " << p2.second << endl;
            cout << p3.first << " " << p3.second << endl;
        }

    }

}


/*
Author :: MD. Musfiqur Rahman Sanim
Aust cse 28th Batch
ID:11.02.04.097
*/

//{ Template
using namespace std;
//{ C-headers
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <cctype>
#include <cassert>
#include <ctime>
//}
//{ C++-headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
//}
//{ Loops
#define forab(i,a,b) for (__typeof(b) i = (a); i <= (b); ++i)
#define rep(i,n) forab (i, 0, (n) - 1)
#define For(i,n) forab (i, 1, n)
#define rofba(i,a,b) for (__typeof(b) i = (b); i >= (a); --i)
#define per(i,n) rofba (i, 0, (n) - 1)
#define rof(i,n) rofba (i, 1, n)
#define forstl(i,s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
//}
//{ Floating-points
#define EPS 1e-7
#define abs(x) (((x) < 0) ? - (x) : (x))
#define zero(x) (abs (x) < EPS)
#define equal(a,b) (zero ((a) - (b)))
#define PI 2*acos (0.0)
//}
typedef long long int64;
typedef unsigned long long int64u;
#define memo(a,v) memset(a,v,sizeof(a))
#define all(a) a.begin(),a.end()
#define db double
#define pb push_back
#define pii pair<int ,int >
#define NL puts("")
//{
//Intput_Output
#define II ({ int a; scanf("%d",&a); a;})
#define IL ({ int64 a; scanf("%lld",&a);  a;})
#define ID ({ db a; scanf("%lf",&a);  a;})
#define IC ({ char a; scanf("%c",&a);  a;})
#define IS ({ string a; cin >> a;  a;})
#define ICA(n) ({ char a[n]; scanf("%s",&a);  a;})
#define OC printf("Case %d:",cs);
//}
//}
template <class T, class U> inline T max (T &a, U &b) {
    return a > b ? a : b;
}
template <class T, class U> inline T min (T &a, U &b) {
    return a < b ? a : b;
}
template <class T, class U> inline T swap (T &a, U &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

const int64 INF = (1ll)<<50;
const int mx = 1e5 + 7;
const int mod = 1000000007 ;
const db pi = PI;
int EQ(double d) {
    if ( fabs(d) < EPS ) return 0;
    return d > EPS ? 1 : -1 ;
}

int64 dis(pii a,pii b) {
    return ((a.first - b.first)*(a.first - b.first) + (a.second-b.second)*(a.second-b.second));
}

int64 arr[1010];
vector<pii >v1,v2;
int main() {
#ifdef Sanim
    freopen ("in.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#endif
    int64 a,b;
    For(i,1000)arr[i] = i*i;
    while(cin >> a >> b) {
        a *= a;
        b *= b;
        int64 c = a + b;

        For(i,1000) {
            if(arr[i]>=a) break;
            int64 tmp = a - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    v1.pb(pii(i,j));
                }
            }
        }

        For(i,1000) {
            if(arr[i]>=b) break;
            int64 tmp = b - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    v2.pb(pii(i,j));
                }
            }
        }
        bool flag = false;
        forstl(it,v1) {
            pii p1 = *it;
            forstl(itt,v2) {
                pii p2 = *itt;
                if(p1.second == p2.second) continue;
                pii p3 = pii(0,0);
                p1 = pii(p3.first+p1.first,p3.second+p1.second);
                p2 = pii(p3.first-p2.first,p3.second+p2.second);
                int64 d = dis(p1,p2);
                if(d==c) {
                    cout << "YES" << endl;
                    cout << p1.first << " " << p1.second << endl;
                    cout << p2.first << " " << p2.second << endl;
                    cout << p3.first << " " << p3.second << endl;
                    flag = true;
                    break;
                }
            }
            if(flag)break;
        }
        if(!flag)cout << "NO" << endl;
        v1.clear();
        v2.clear();

    }

}


/*
Author :: MD. Musfiqur Rahman Sanim
Aust cse 28th Batch
ID:11.02.04.097
*/

//{ Template
using namespace std;
//{ C-headers
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <cctype>
#include <cassert>
#include <ctime>
//}
//{ C++-headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
//}
//{ Loops
#define forab(i,a,b) for (__typeof(b) i = (a); i <= (b); ++i)
#define rep(i,n) forab (i, 0, (n) - 1)
#define For(i,n) forab (i, 1, n)
#define rofba(i,a,b) for (__typeof(b) i = (b); i >= (a); --i)
#define per(i,n) rofba (i, 0, (n) - 1)
#define rof(i,n) rofba (i, 1, n)
#define forstl(i,s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
//}
//{ Floating-points
#define EPS 1e-7
#define abs(x) (((x) < 0) ? - (x) : (x))
#define zero(x) (abs (x) < EPS)
#define equal(a,b) (zero ((a) - (b)))
#define PI 2*acos (0.0)
//}
typedef long long int64;
typedef unsigned long long int64u;
#define memo(a,v) memset(a,v,sizeof(a))
#define all(a) a.begin(),a.end()
#define db double
#define pb push_back
#define pii pair<int ,int >
#define pdd pair<db ,db >
#define NL puts("")
//{
//Intput_Output
#define II ({ int a; scanf("%d",&a); a;})
#define IL ({ int64 a; scanf("%lld",&a);  a;})
#define ID ({ db a; scanf("%lf",&a);  a;})
#define IC ({ char a; scanf("%c",&a);  a;})
#define IS ({ string a; cin >> a;  a;})
#define ICA(n) ({ char a[n]; scanf("%s",&a);  a;})
#define OC printf("Case %d:",cs);
//}
//}
template <class T, class U> inline T max (T &a, U &b) {
    return a > b ? a : b;
}
template <class T, class U> inline T min (T &a, U &b) {
    return a < b ? a : b;
}
template <class T, class U> inline T swap (T &a, U &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

const int64 INF = (1ll)<<50;
const int mx = 1e5 + 7;
const int mod = 1000000007 ;
const db pi = PI;
int EQ(double d) {
    if ( fabs(d) < EPS ) return 0;
    return d > EPS ? 1 : -1 ;
}

int64 arr[1010];
void call() {
    cout << "NO" << endl;
    exit(0);
}
int main() {
#ifdef Sanim
    freopen ("in.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#endif
    cout << setprecision(10) << fixed;
    int64 a,b;
    For(i,1000) {
        arr[i] = i*i;
    }
    while(cin >> a >> b ) {
        a *= a;
        b *= b;
int64 c = a+b;
        int c = -1,d = -1,e = -1,f = -1;
        For(i,1000) {
            if(arr[i] >= a) break;
            int64 tmp = a - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    c = i;
                    d = j;
                    break;
                }
            }
            if(c!=-1) break;
        }

        For(i,1000) {
            if(arr[i] >= b) break;
            int64 tmp = b - arr[i];
            For(j,1000) {
                if(tmp == arr[j] && j!=d) {
                    e = i;
                    f = j;
                    break;
                }
            }
            //if(e!=-1) break;
        }

        if(c == -1 || e == -1) {
            call();
        } else {
            pii p1 = pii(-2,-2);
            pii p2 = pii(p1.first+c,p1.second+d);
            pii p3 = pii(p1.first-e,p1.second+f);
int64 tmp = p2.first-p3.first;
tmp *= tmp;
c -= tmp;
 tmp = p2.second-p3.second;
tmp *= tmp;
c -= tmp;
if(c) call();
            cout << "YES" << endl;
            cout << p1.first << " " << p1.second << endl;
            cout << p2.first << " " << p2.second << endl;
            cout << p3.first << " " << p3.second << endl;
        }

    }

}


/*
Author :: MD. Musfiqur Rahman Sanim
Aust cse 28th Batch
ID:11.02.04.097
*/

//{ Template
using namespace std;
//{ C-headers
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <cctype>
#include <cassert>
#include <ctime>
//}
//{ C++-headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
//}
//{ Loops
#define forab(i,a,b) for (__typeof(b) i = (a); i <= (b); ++i)
#define rep(i,n) forab (i, 0, (n) - 1)
#define For(i,n) forab (i, 1, n)
#define rofba(i,a,b) for (__typeof(b) i = (b); i >= (a); --i)
#define per(i,n) rofba (i, 0, (n) - 1)
#define rof(i,n) rofba (i, 1, n)
#define forstl(i,s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
//}
//{ Floating-points
#define EPS 1e-7
#define abs(x) (((x) < 0) ? - (x) : (x))
#define zero(x) (abs (x) < EPS)
#define equal(a,b) (zero ((a) - (b)))
#define PI 2*acos (0.0)
//}
typedef long long int64;
typedef unsigned long long int64u;
#define memo(a,v) memset(a,v,sizeof(a))
#define all(a) a.begin(),a.end()
#define db double
#define pb push_back
#define pii pair<int ,int >
#define pdd pair<db ,db >
#define NL puts("")
//{
//Intput_Output
#define II ({ int a; scanf("%d",&a); a;})
#define IL ({ int64 a; scanf("%lld",&a);  a;})
#define ID ({ db a; scanf("%lf",&a);  a;})
#define IC ({ char a; scanf("%c",&a);  a;})
#define IS ({ string a; cin >> a;  a;})
#define ICA(n) ({ char a[n]; scanf("%s",&a);  a;})
#define OC printf("Case %d:",cs);
//}
//}
template <class T, class U> inline T max (T &a, U &b) {
    return a > b ? a : b;
}
template <class T, class U> inline T min (T &a, U &b) {
    return a < b ? a : b;
}
template <class T, class U> inline T swap (T &a, U &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

const int64 INF = (1ll)<<50;
const int mx = 1e5 + 7;
const int mod = 1000000007 ;
const db pi = PI;
int EQ(double d) {
    if ( fabs(d) < EPS ) return 0;
    return d > EPS ? 1 : -1 ;
}

int64 arr[1010];
void call() {
    cout << "NO" << endl;
    exit(0);
}
int main() {
#ifdef Sanim
    freopen ("in.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#endif
    cout << setprecision(10) << fixed;
    int64 a,b;
    For(i,1000) {
        arr[i] = i*i;
    }
    while(cin >> a >> b ) {
        a *= a;
        b *= b;

        int c = -1,d = -1,e = -1,f = -1;
        For(i,1000) {
            if(arr[i] > a) break;
            int64 tmp = a - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    c = i;
                    d = j;
                    break;
                }
            }
           // if(c!=-1) break;
        }

        For(i,1000) {
            if(arr[i] > b) break;
            int64 tmp = b - arr[i];
            For(j,1000) {
                if(tmp == arr[j] && j!=d) {
                    e = i;
                    f = j;
                    break;
                }
            }
            if(e!=-1) break;
        }

        if(c == -1 || e == -1) {
            call();
        } else {
            pii p1 = pii(-2,-2);
            pii p2 = pii(p1.first+c,p1.second+d);
            pii p3 = pii(p1.first-e,p1.second+f);
            cout << "YES" << endl;
            cout << p1.first << " " << p1.second << endl;
            cout << p2.first << " " << p2.second << endl;
            cout << p3.first << " " << p3.second << endl;
        }

    }

}


/*
Author :: MD. Musfiqur Rahman Sanim
Aust cse 28th Batch
ID:11.02.04.097
*/

//{ Template
using namespace std;
//{ C-headers
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <cctype>
#include <cassert>
#include <ctime>
//}
//{ C++-headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
//}
//{ Loops
#define forab(i,a,b) for (__typeof(b) i = (a); i <= (b); ++i)
#define rep(i,n) forab (i, 0, (n) - 1)
#define For(i,n) forab (i, 1, n)
#define rofba(i,a,b) for (__typeof(b) i = (b); i >= (a); --i)
#define per(i,n) rofba (i, 0, (n) - 1)
#define rof(i,n) rofba (i, 1, n)
#define forstl(i,s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
//}
//{ Floating-points
#define EPS 1e-7
#define abs(x) (((x) < 0) ? - (x) : (x))
#define zero(x) (abs (x) < EPS)
#define equal(a,b) (zero ((a) - (b)))
#define PI 2*acos (0.0)
//}
typedef long long int64;
typedef unsigned long long int64u;
#define memo(a,v) memset(a,v,sizeof(a))
#define all(a) a.begin(),a.end()
#define db double
#define pb push_back
#define pii pair<int ,int >
#define pdd pair<db ,db >
#define NL puts("")
//{
//Intput_Output
#define II ({ int a; scanf("%d",&a); a;})
#define IL ({ int64 a; scanf("%lld",&a);  a;})
#define ID ({ db a; scanf("%lf",&a);  a;})
#define IC ({ char a; scanf("%c",&a);  a;})
#define IS ({ string a; cin >> a;  a;})
#define ICA(n) ({ char a[n]; scanf("%s",&a);  a;})
#define OC printf("Case %d:",cs);
//}
//}
template <class T, class U> inline T max (T &a, U &b) {
    return a > b ? a : b;
}
template <class T, class U> inline T min (T &a, U &b) {
    return a < b ? a : b;
}
template <class T, class U> inline T swap (T &a, U &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 Direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

const int64 INF = (1ll)<<50;
const int mx = 1e5 + 7;
const int mod = 1000000007 ;
const db pi = PI;
int EQ(double d) {
    if ( fabs(d) < EPS ) return 0;
    return d > EPS ? 1 : -1 ;
}

int64 arr[1010];
void call() {
    cout << "NO" << endl;
    exit(0);
}
int main() {
#ifdef Sanim
    freopen ("in.txt", "r", stdin);
    // freopen ("output.txt", "w", stdout);
#endif
    cout << setprecision(10) << fixed;
    int64 a,b;
    For(i,1000) {
        arr[i] = i*i;
    }
    while(cin >> a >> b ) {
        a *= a;
        b *= b;

        int c = -1,d = -1,e = -1,f = -1;
        For(i,1000) {
            if(arr[i] > a) break;
            int64 tmp = a - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    c = i;
                    d = j;
                    break;
                }
            }
            if(c!=-1) break;
        }

        For(i,1000) {
            if(arr[i] > b) break;
            int64 tmp = b - arr[i];
            For(j,1000) {
                if(tmp == arr[j]) {
                    e = i;
                    f = j;
                    break;
                }
            }
            if(e!=-1) break;
        }

        if(c == -1 || e == -1) {
            call();
        } else {
            if(d==f)swap(c,d);
            if(d==f) {
                swap(c,d);
                swap(e,f);
            }
            if(d==f)call();
            pii p1 = pii(1001,0);
            pii p2 = pii(p1.first+c,p1.second+d);
            pii p3 = pii(p1.first-e,p1.second+f);
            cout << "YES" << endl;
            cout << p1.first << " " << p1.second << endl;
            cout << p2.first << " " << p2.second << endl;
            cout << p3.first << " " << p3.second << endl;
        }

    }

}