← Home
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var a, b int
	if _, err := fmt.Fscan(in, &a, &b); err != nil {
		return
	}

	g := gcd(a, b)
	found := false
	var ax, ay, bx, by int

	for c := 1; c <= g && !found; c++ {
		if g%c != 0 {
			continue
		}
		cc := c * c
		for x := 1; x < c && !found; x++ {
			y2 := cc - x*x
			if y2 <= 0 {
				continue
			}
			y := int(math.Sqrt(float64(y2)))
			if y*y != y2 {
				continue
			}
			m := a / c
			n := b / c

			
			ux, uy := m*x, m*y
			vx1, vy1 := -n*y, n*x
			wy1 := vy1 - uy
			if wy1 != 0 {
				ax, ay = 0, 0
				bx, by = ux, uy
				fmt.Fprintln(out, "YES")
				fmt.Fprintln(out, ax, ay)
				fmt.Fprintln(out, bx, by)
				fmt.Fprintln(out, vx1, vy1)
				found = true
				break
			}

			
			vx2, vy2 := n*y, -n*x
			wx2 := vx2 - ux
			if wx2 != 0 {
				ax, ay = 0, 0
				bx, by = ux, uy
				fmt.Fprintln(out, "YES")
				fmt.Fprintln(out, ax, ay)
				fmt.Fprintln(out, bx, by)
				fmt.Fprintln(out, vx2, vy2)
				found = true
				break
			}
		}
	}

	if !found {
		fmt.Fprintln(out, "NO")
	}
}