#include <bits/stdc++.h>
using namespace std;
void swap1(int &a, int &b) {
  int t = a;
  a = b;
  b = t;
}
int main(void) {
  int ax, ay, bx, by, cx, cy, m, a1, b1, c1, m1, m2, m3, flag, flaga, flagb,
      flagc, a, b, c;
  scanf("%d%d", &a, &b);
  a = a * a;
  b = b * b;
  c = a + b;
  ax = ay = 1;
  flaga = flagb = flagc = flag = 0;
  for (by = 2;; by++) {
    m = (2 - ax) * (2 - ax) + (by - ay) * (by - ay);
    if (m > c) {
      break;
    }
    for (bx = 2;; bx++) {
      a1 = a;
      b1 = b;
      c1 = c;
      flaga = flagb = flagc = flag = 0;
      m = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
      if (m == a) {
        flag = flaga = 1;
        break;
      } else if (m == b) {
        flag = flagb = 1;
        break;
      } else if (m == c) {
        flag = flagc = 1;
        break;
      } else if (m > c) {
        break;
      }
    }
    if (flag) {
      if (flaga) {
        a1 = b1;
        b1 = c1;
      } else if (flagb) {
        b1 = c1;
      }
      if (a1 > b1) {
        swap1(a1, b1);
      }
      flag = 0;
      for (cy = by + 1;; cy++) {
        m1 = (2 - ax) * (2 - ax) + (cy - ay) * (cy - ay);
        m2 = (2 - bx) * (2 - bx) + (cy - by) * (cy - by);
        if (m1 > b1 && m2 > b1) {
          break;
        }
        for (cx = 2;; cx++) {
          m1 = (cx - ax) * (cx - ax) + (cy - ay) * (cy - ay);
          m2 = (cx - bx) * (cx - bx) + (cy - by) * (cy - by);
          if (m1 > b1 || m2 > b1) {
            break;
          } else if ((m1 == a1 && m2 == b1) || (m1 == b1 && m2 == a1)) {
            flag = 1;
            break;
          }
        }
        if (flag) {
          break;
        }
      }
      if (flag) {
        printf("YES\n");
        printf("%d %d\n", ax, ay);
        printf("%d %d\n", bx, by);
        printf("%d %d\n", cx, cy);
        break;
      } else {
        flag = 0;
        for (cy = 2;; cy++) {
          if (cy == by) {
            cy++;
          }
          m1 = (0 - ax) * (0 - ax) + (cy - ay) * (cy - ay);
          m2 = (0 - bx) * (0 - bx) + (cy - by) * (cy - by);
          if (m1 > b1 && m2 > b1) {
            break;
          }
          for (cx = 0;; cx--) {
            m1 = (cx - ax) * (cx - ax) + (cy - ay) * (cy - ay);
            m2 = (cx - bx) * (cx - bx) + (cy - by) * (cy - by);
            if (m1 > b1 || m2 > b1) {
              break;
            } else if ((m1 == a1 && m2 == b1) || (m1 == b1 && m2 == a1)) {
              flag = 1;
              break;
            }
          }
          if (flag) {
            break;
          }
        }
        if (flag) {
          printf("YES\n");
          printf("%d %d\n", ax, ay);
          printf("%d %d\n", bx, by);
          printf("%d %d\n", cx, cy);
          break;
        }
      }
    }
  }
  if (!flag) {
    printf("NO\n");
  }
  return 0;
}
