package main

import (
    "fmt"
)

func gcd(a int64, b int64) int64 {
    if b == 0 { return a }
    return gcd(b, a % b)
}

func lcm(a int64, b int64) int64 {
    return a / gcd(a, b) * b
}

func min(a int64, b int64) int64 {
    if a < b { return a }
    return b
}

func max(a int64, b int64) int64 {
    if a > b { return a }
    return b
}

func main() {
    var x int64
    fmt.Scanf("%d", &x)
    ans := x
    for i := int64(1); i * i < x; i++ {
        if x % i != 0 { continue }

        j := x / i
        if lcm(i, j) == x {
            ans = min(ans, max(i, j))
        }
    }
    fmt.Println(x / ans, ans)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	//fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		n := int64(0)
		fmt.Fscanf(in, "%d\n", &n)
		a, b := int64(1), n
		for i := int64(1); i*i <= n; i++ {
			if n%i == 0 {
				if max(i, n/i) < max(a, b) && gcd(i, n/i) == 1 {
					a, b = i, n/i
				}
			}
		}
		fmt.Fprintf(out, "%d %d\n", a, b)
	}
	return
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func gcd(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

package main

import (
	"fmt"
	"math"
)

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func main() {
	var x, xx int64
	fmt.Scan(&x)
	sqrtx := int64(math.Sqrt(float64(x)))
	a := make([]int64, 0, 20)
	xx = x
	for i := int64(2); i <= sqrtx; i++ {
		var b int64 = 1
		for xx % i == 0 {
			b *= i
			xx /= i
		}
		if b > 1 {
			a = append(a, b)
		}
	}
	// fmt.Println(a)
	ans := x
	for i := 0; i < (1 << uint(len(a))); i++ {
		var tmp int64 = 1
		for j := 0; j < len(a); j++ {
			if (i & (1 << uint(j))) != 0 {
				tmp *= a[j]
			}
		}
		// fmt.Println(i, tmp)
		tmp = max(tmp, x/tmp)
		ans = min(ans, tmp)
	}
	fmt.Println(ans, x/ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"sync"
)
func gcd(a,b int64)int64{
	if(a==0){
		return b
	}
	return gcd(b%a,a)
}
func lcm(a,b int64)int64{
	return a/gcd(a,b)*b
}
func min(a,b int64)int64{
	if(a>b){
		return b
	}else{
		return a
	}
}
func max(a,b int64)int64{
	if(a>b){
		return a
	}
	return b
}
func main(){
	var n int64
	fmt.Scan(&n)
	var mx int64
	mx=n
	for i:=int64(1);int64(i*i)<=n;i++{
		if(n%i==0&&lcm(i,n/i)==n){
			mx=min(mx,max(i,n/i))
		}
	}
	fmt.Println(mx,n/mx)
}

/*********************** utility ***********************/

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	// set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

		for line := range out {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ReadString() string {
	in.Scan()
	return in.Text()
}

func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}

func ReadInt() int {
	intStr := ReadString()
	i, _ := strconv.Atoi(intStr)
	return i
}

func ReadIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}

package main

import (
	"fmt"
	"math"
)

func isPrime(number int64) bool {
	if number <= 1 {
		return false
	}
	if number == 2 {
		return true
	}
	if number%2 == 0 {
		return false
	}
	sqrNumber := int64(math.Sqrt(float64(number)))

	for i := int64(2); i <= sqrNumber; i++ {
		if number%i == 0 {
			return false
		}
	}
	return true
}

func gcd(m int64, n int64) int64 {
	if n == 0 {
		return m
	}
	return gcd(n, m%n)
}

func MaxLCM(n int64) (ansA int64, ansB int64) {
	if isPrime(n) || n == 1 {
		return 1, n
	}
	sqrNumber := int64(math.Sqrt(float64(n)))
	var ANS_END int64 = int64(math.Pow(10, 12)) + 1
	ansA = ANS_END
	ansB = ANS_END
	for i := int64(1); i <= sqrNumber; i++ {
		a := i
		if n%a == 0 {
			b := n / a
			if b < ansB && (a == 1 || gcd(a, b) == 1) {
				ansA = a
				ansB = b
			}
		}
	}
	return ansA, ansB
}

func main() {
	var n int64 = 0
	fmt.Scanf("%d\n", &n)
	fmt.Println(MaxLCM(n))
}

package main

import (
	"fmt"
	"math"
)

func max(a,b int64) int64 {
	if a<b{
		return b
	}else{
		return a
	}
}

func gcd(a,b int64)int64{
	if b==0{
		return a
	}else{
		return gcd(b,a%b)
	}
}

func lcm(a,b int64)int64{
	return a/gcd(a,b)*b
}

func main() {
	var x int64
	fmt.Scanf("%d",&x)
	var a,b int64
	var mx int64=math.MaxInt64
	for i:=int64(1);i*i<=x;i++{
		if x%i==0{
			if max(i,x/i)<mx && lcm(i,x/i)==x{
				a=i
				b=x/i
				mx=max(i,x/i)
			}
		}
	}
	fmt.Printf("%d %d\n",a,b)
}

/*
URL:
https://codeforces.com/problemset/problem/1285/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	x int64
)

func main() {
	x = ReadInt64()

	if x == 1 {
		fmt.Println(1, 1)
		return
	}

	memo := TrialDivision(x)
	A := []int64{}
	for k, v := range memo {
		A = append(A, PowInt(k, v))
	}

	ans := int64(INF_BIT60)
	ma, mb := int64(-1), int64(-1)
	n := len(A)
	for i := 0; i < (1 << uint(n)); i++ {
		a, b := int64(1), int64(1)
		for j := 0; j < n; j++ {
			if NthBit(int64(i), j) == 1 {
				a *= A[j]
			} else {
				b *= A[j]
			}
		}

		if ChMin(&ans, Max(a, b)) {
			ma, mb = a, b
		}
	}

	fmt.Println(ma, mb)
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int64, target int64) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int64) int64 {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num int64, nth int) int64 {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num int64, nth int) int64 {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num int64, nth int) int64 {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int64) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int64) int64 {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int64) map[int64]int64 {
	var i, exp int64
	p := map[int64]int64{}

	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	for i = 2; i*i <= n; i++ {
		exp = 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return a
}

func scanInt64() int64 {
	sc.Scan()
	a, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 {
			fmt.Fprint(wr, " ")
		}
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

var (
	x int64
	fac []int64
)

func main() {
	sc.Split(bufio.ScanWords)
	x = scanInt64()
	ans := x
	ret := [...]int64 {1, x}
	for i := int64(2); i * i <= x; i++ {
		if x % i == 0 {
			mul := int64(1)
			for x % i == 0 {
				x /= i
				mul *= i
			}
			fac = append(fac, mul)
		}
	}
	if x != 1 {
		fac = append(fac, x)
	}
	facLen := uint(len(fac))
	for mask := uint(0); mask < (1 << facLen); mask++ {
		mul := [...]int64 {1, 1}
		for i := uint(0); i < facLen; i++ {
			mul[mask >> i & 1] *= fac[i]
		}
		if mul[0] > mul[1] {
			mul[0], mul[1] = mul[1], mul[0]
		}
		maxMul := mul[0]
		if mul[1] > maxMul {
			maxMul = mul[1]
		}
		if maxMul < ans {
			ans = maxMul
			ret[0], ret[1] = mul[0], mul[1]
		}
	}
	fmt.Printf("%d %d\n", ret[0], ret[1])
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"sync"
)
func __gcd(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return __gcd(b, a % b)
}
func work() {
	n := ReadInt()
	a, b := n, int64(1)
	for i := int64(2); i * i <= n; i++ {
		if n % i == 0 {
			c, d := n / i, i
			if __gcd(c, d) == 1 {
				a, b = c, d
			}
		}
	}

	fmt.Println(a, b)
}
func main() {
	work()
	close(out)
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup
func ReadString() string {
	in.Scan()
	return in.Text()
}
func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}
func ReadInt() int64 {
	intStr := ReadString()
	i, _  := strconv.ParseInt(intStr, 10, 64)
	return i
}
func ReadIntSlice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}
func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	//set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(write *bufio.Writer) {
		defer outWg.Done()
		defer write.Flush()

		for line := range out {
			write.WriteString(line + "\n")
		}
	}(writer)
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	X := readll()
	minv := int64(10000000000000)
	var ansa, ansb int64
	for i := int64(1); i*i <= X; i++ {
		if X%i != 0 {
			continue
		}
		b := X / i
		if gcdll(i, b) != 1 {
			continue
		}
		v := maxll(i, b)
		if v < minv {
			minv = v
			ansa = i
			ansb = b
		}
	}
	println(ansa, ansb)
}

package main

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

func main() {

	x := ReadInt64()
	ans := int64(0)
	for i := int64(1); i*i <= x; i++ {
		if x%i == 0 && LCM(x/i, i) == x {
			ans = i
		}
	}

	out <- fmt.Sprintf("%v %v", ans, (x / ans))
	close(out)
	outWg.Wait()
}

/*********************** I/O ***********************/

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	// set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

		for line := range out {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ReadString() string {
	in.Scan()
	return in.Text()
}

func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}

func ReadInt64() int64 {
	intStr := ReadString()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ReadInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Max(args ...int64) int64 {
	maxV := int64(math.MinInt64)
	for _, v := range args {
		if v > maxV {
			maxV = v
		}
	}
	return maxV
}

func Min(args ...int64) int64 {
	minV := int64(math.MaxInt64)
	for _, v := range args {
		if v < minV {
			minV = v
		}
	}
	return minV
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func S(v int64) string {
	return strconv.FormatInt(v, 64)
}

package main

import (
    "fmt"
)

func min(a int64, b int64) int64 {
    if a < b { return a }
    return b
}

func max(a int64, b int64) int64 {
    if a > b { return a }
    return b
}

func main() {
    var x int64
    fmt.Scanf("%d", &x)
    ans := x
    for i := int64(1); i * i < x; i++ {
        j := x / i
        ans = min(ans, max(i, j))
    }
    fmt.Println(x / ans, ans)
}

package main

import (
    "fmt"
    "math"
)

func isPrime(number int64) bool {
    if number <= 1 {
        return false
    }
    if number == 2 {
        return true
    }
    if number%2 == 0 {
        return false
    }
    sqrNumber := int64(math.Sqrt(float64(number)))

    for i := int64(2); i <= sqrNumber; i++ {
        if number%i == 0 {
            return false
        }
    }
    return true
}

func gcd(m int64, n int64) int64 {
    if n == 0 {
        return m
    }
    return gcd(n, m%n)
}

func MaxLCM(n int64) (ansA int64, ansB int64) {
    if isPrime(n) || n == 1 {
        return 1, n
    }
    sqrNumber := int64(math.Sqrt(float64(n)))
    var ANS_END int64 = int64(math.Pow(10, 12)) + 1
    ansA = ANS_END
    ansB = ANS_END
    for i := int64(1); i <= sqrNumber; i++ {
        a := i
        if n%a == 0 {
            b := n / a
            if b < ansB {
                ansA = a
                ansB = b
            }
        }
    }
    return ansA, ansB
}

func main() {
    var n int64 = 0
    fmt.Scanf("%d\n", &n)
    fmt.Println(MaxLCM(n))
}

package main

import (
	"fmt"
	"math"
)

func isPrime(number int64) bool {
	if number <= 1 {
		return false
	}
	if number == 2 {
		return true
	}
	if number%2 == 0 {
		return false
	}
	sqrNumber := int64(math.Sqrt(float64(number)))

	for i := int64(2); i <= sqrNumber; i++ {
		if number%i == 0 {
			return false
		}
	}
	return true
}

func gcd(m int64, n int64) int64 {
	if n == 0 {
		return m
	}
	return gcd(n, m%n)
}

func MaxLCM(n int64) (ansA int64, ansB int64) {
	if isPrime(n) || n == 1 {
		return 1, n
	}
	sqrNumber := int64(math.Sqrt(float64(n)))
	var ANS_END int64 = int64(math.Pow(10, 12)) + 1
	ansA = ANS_END
	ansB = ANS_END
	for i := int64(1); i <= sqrNumber; i++ {
		a := i
		if n%a == 0 {
			b := n / a
			if b < ansB && a != b {
				ansA = a
				ansB = b
			}
		}
	}
	return ansA, ansB
}

func main() {
	var n int64 = 0
	fmt.Scanf("%d\n", &n)
	fmt.Println(MaxLCM(n))
}

package main

import (
	"fmt"
	"math"
)

func max(a,b int64) int64 {
	if a<b{
		return b
	}else{
		return a
	}
}

func main() {
	var x int64
	fmt.Scanf("%d",&x)
	var a,b int64
	var mx int64=math.MaxInt64
	for i:=int64(1);i*i<=x;i++{
		if x%i==0{
			if max(i,x/i)<mx{
				a=i
				b=x/i
				mx=max(i,x/i)
			}
		}
	}
	fmt.Printf("%d %d\n",a,b)
}

package main

import (
	"fmt"
	"math"
)

func max(a,b int64) int64 {
	if a<b{
		return b
	}else{
		return a
	}
}

func main() {
	var x int64
	fmt.Scanf("%d",&x)
	var a,b int64
	var mx int64=math.MaxInt64
	for i:=int64(1);i*i<=x;i++{
		if x%i==0{
			if max(i,x/i)<mx && (i!=x/i || i==1 && x==1) {
				a=i
				b=x/i
				mx=max(i,x/i)
			}
		}
	}
	fmt.Printf("%d %d\n",a,b)
}

package main

import (
	"fmt"
	"math"
)

func max(a,b int64) int64 {
	if a<b{
		return b
	}else{
		return a
	}
}

func main() {
	var x int64
	fmt.Scanf("%d",&x)
	var a,b int64
	var mx int64=math.MaxInt64
	for i:=int64(1);i*i<=x;i++{
		if x%i==0{
			if max(i,x/i)<mx && i!=x/i{
				a=i
				b=x/i
				mx=max(i,x/i)
			}
		}
	}
	fmt.Printf("%d %d\n",a,b)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"sync"
)
func __gcd(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return __gcd(b, a % b)
}
func work() {
	n := ReadInt()
	a, b := n, int64(1)
	for i := int64(2); i * i <= n; i++ {
		if n % i == 0 {
			c, d := n / i, i
			gcd := __gcd(c, d)
			d = d * gcd
			if c < d {
				c, d = d, c
			}
			if a > c {
				a, b = c, d
			}
		}
	}

	fmt.Println(a, b)
}
func main() {
	work()
	close(out)
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup
func ReadString() string {
	in.Scan()
	return in.Text()
}
func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}
func ReadInt() int64 {
	intStr := ReadString()
	i, _  := strconv.ParseInt(intStr, 10, 64)
	return i
}
func ReadIntSlice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}
func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	//set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(write *bufio.Writer) {
		defer outWg.Done()
		defer write.Flush()

		for line := range out {
			write.WriteString(line + "\n")
		}
	}(writer)
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func inc(x int64) int64 {
	return x + 1
}
func dec(x int64) int64 {
	return x - 1
}
func isOdd(x int64) bool {
	return x%1 == 1
}

func isNotOdd(x int64) bool {
	return !isOdd(x)
}

func readInt(scanner *bufio.Scanner) int64 {
	scanner.Scan()
	raw := scanner.Text()
	result, _ := strconv.ParseInt(strings.Trim(raw, " \n\r"), 10, 64)
	return result
}
func getWithCalc(x int64, cond func(int64) bool, f func(int64) int64) int64 {
	if cond(x) {
		return f(x)
	}
	return x
}
func check(x1, y1, x2, y2 int64) int64 {

	a1 := 1 + (getWithCalc(x2, isOdd, dec)-getWithCalc(x1, isOdd, inc))/2
	b1 := 1 + (getWithCalc(y2, isOdd, dec)-getWithCalc(y1, isOdd, inc))/2

	a2 := 1 + (getWithCalc(x2, isNotOdd, dec)-getWithCalc(x1, isNotOdd, inc))/2
	b2 := 1 + (getWithCalc(y2, isNotOdd, dec)-getWithCalc(y1, isNotOdd, inc))/2

	return a1*b1 + a2*b2
}
func solve(in io.Reader, out io.Writer) {
	reader := bufio.NewScanner(in)
	reader.Split(bufio.ScanWords)

	fmt.Fprintln(out, check(readInt(reader), readInt(reader), readInt(reader), readInt(reader)))
}

func main() {
	solve(os.Stdin, os.Stdout)
}

package main

import "fmt"

func main() {
	var x1, y1, x2, y2 int64
	fmt.Scanf("%d %d %d %d", &x1, &y1, &x2, &y2)

	var dx, dy, num_prim_cols, num_sec_cols, len_prim_cols, len_sec_cols int64
	dx = x2 - x1
	dy = y2 - y1
	num_prim_cols = dx / 2 + 1 //dx guaranteed to be divisible by 2
	num_sec_cols = num_prim_cols - 1
	len_prim_cols = dy / 2 + 1
	len_sec_cols = 0
//	fmt.Printf("dx=\t%d\ndy=\t%d\nprim_cols=\t%d\nsec_cols=\t%d\n", dx, dy, num_prim_cols, num_sec_cols)

	if ( dy % 2 == 0) {
		len_sec_cols = dy / 2
	} else {
		len_sec_cols = dy / 2 + 1
	}
//	fmt.Printf("\nlen_prim_cols=\t%d\nlen_sec_cols=\t%d\n", len_prim_cols, len_sec_cols)

	fmt.Println(num_prim_cols * len_prim_cols + num_sec_cols * len_sec_cols)
}

package main

import "fmt"

func main() {
	var x1, y1, x2, y2 int64
	fmt.Scanf("%d %d %d %d", &x1, &y1, &x2, &y2)

	var dx, dy, num_prim_cols, num_sec_cols, len_prim_cols, len_sec_cols int64
	dx = x2 - x1
	dy = y2 - y1
	num_prim_cols = dx / 2 + 1 //dx guaranteed to be divisible by 2
	num_sec_cols = num_prim_cols - 1
	len_prim_cols = dy / 2 + 1
	len_sec_cols = 0
	fmt.Printf("dx=\t%d\ndy=\t%d\nprim_cols=\t%d\nsec_cols=\t%d\n",
		dx, dy, num_prim_cols, num_sec_cols)

	if ( dy % 2 == 0) {
		len_sec_cols = dy / 2
	} else {
		len_sec_cols = dy / 2 + 1
	}
	fmt.Printf("\nlen_prim_cols=\t%d\nlen_sec_cols=\t%d\n",
		len_prim_cols, len_sec_cols)

	fmt.Println("Total cells = ", num_prim_cols * len_prim_cols + num_sec_cols * len_sec_cols)
}

package main

import "fmt"

func main() {
	var x1, y1, x2, y2 int64
	fmt.Scanf("%d %d %d %d", &x1, &y1, &x2, &y2)

	var dx, dy, num_prim_cols, num_sec_cols, len_prim_cols, len_sec_cols int64
	dx = x2 - x1
	dy = y2 - y1
	num_prim_cols = dx / 2 + 1 //dx guaranteed to be divisible by 2
	num_sec_cols = num_prim_cols - 1
	len_prim_cols = dy / 2 + 1
	len_sec_cols = 0
//	fmt.Printf("dx=\t%d\ndy=\t%d\nprim_cols=\t%d\nsec_cols=\t%d\n", dx, dy, num_prim_cols, num_sec_cols)

	if ( dy % 2 == 0) {
		len_sec_cols = dy / 2
	} else {
		len_sec_cols = dy / 2 + 1
	}
//	fmt.Printf("\nlen_prim_cols=\t%d\nlen_sec_cols=\t%d\n", len_prim_cols, len_sec_cols)

	fmt.Println("Total cells = ", num_prim_cols * len_prim_cols + num_sec_cols * len_sec_cols)
}


package main

import "fmt"

func main() {

	var l, r, x, y, k int64
	fmt.Scanf("%d %d %d %d %d", &l, &r, &x, &y, &k)
	for cost := x; cost <= y; cost++ {
		experience := k * cost
		if experience >= l && experience <= r {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")

}

package main

import "fmt"

func main(){
	var a,b,c,d,e int
	var ans=false
	fmt.Scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
	for i:=c;i<=d;i++ {
		var comp=int64(i)*int64(e)
		if int64(a)<=comp && comp<=int64(b){
			ans=true
		}
	}
	if ans{
		fmt.Printf("YES\n")
	} else{
		fmt.Printf("NO\n")
	}
}

package main

import "fmt"

func main() {
	var l, r, x, y, k int64
	fmt.Scanf("%d %d %d %d %d", &l, &r, &x, &y, &k)
	for i := l; i <= r; i++ {
		if (x*k <= i) && (i <= y*k) && (i%k == 0) {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	l := readInt64()
	r := readInt64()
	x := readInt64()
	y := readInt64()
	k := readInt64()
	for j := x; j <= y; j++ {
		t := j * k
		if t > r {
			break
		}
		if t >= l && t <= r {
			fmt.Println("YES")
			return
		}
	}
	// for i := l; i <= r; i++ {
	// 	for j := x; j <= y; j++ {
	// 		if i%j == 0 && i/j == k {
	// 			fmt.Println("YES")
	// 			return
	// 		}
	// 	}
	// }
	fmt.Println("NO")
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
  "fmt"
)

func main() {
  var l, r, x, y, k int
  fmt.Scanf("%d %d %d %d %d\n", &l, &r, &x, &y, &k)
  for b := x; b <= y; b++ {
    a := int64(b) * int64(k)
    if int64(l) <= a && a <= int64(r) {
      fmt.Printf("YES\n")
      return
    }
  }
  fmt.Printf("NO\n")
}

package main

import "fmt"

func main() {
	var l, r, x, y, k int64
	fmt.Scan(&l, &r, &x, &y, &k)
	if x*k < l {
		x = (l + k - 1) / k
	}
	if y*k > r {
		y = r / k
	}
	if x > y {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

package main

import "fmt"

func main(){
	var a,b,c,d,e int
	var ans=false
	fmt.Scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
	for i:=c;i<d;i++{
		if a<=i*e && i*e<=b{
			ans=true
		}
	}
	if ans{
		fmt.Printf("YES\n")
	} else{
		fmt.Printf("NO\n")
	}
}

package main

import "fmt"

func main(){
	var a,b,c,d,e int
	var ans=false
	fmt.Scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
	for i:=c;i<=d;i++ {
		if a<=i*e && i*e<=b{
			ans=true
		}
	}
	if ans{
		fmt.Printf("YES\n")
	} else{
		fmt.Printf("NO\n")
	}
}

package main

import "fmt"

func main(){
	var a,b,c,d,e int
	fmt.Scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
	var best,worst,k float64
	best,worst,k=float64(b)/float64(c),float64(a)/float64(d),float64(e)
	if k>=worst && k<=best	{
		fmt.Printf("YES\n")
	} else{
		fmt.Printf("NO\n")
	}
}

package main

import "fmt"

func main() {
	var l, r, x, y, k int
	fmt.Scanf("%d %d %d %d %d", &l, &r, &x, &y, &k)
	for i := l; i <= r; i++ {
		if (x*k <= i) && (i <= y*k) && (i%k == 0) {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}

package main

import "fmt"

func main() {

	var l, r, x, y, k int
	fmt.Scanf("%d %d %d %d %d", &l, &r, &x, &y, &k)
	for cost := x; cost <= y; cost++ {
		experience := k * cost
		if experience >= l && experience <= r {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")

}

package main

import "fmt"

func main() {
	var l, r, x, y, k int
	fmt.Scan(&l, &r, &x, &y, &k)
	if x*k < l {
		x = (l + k - 1) / k
	}
	if y*k > r {
		y = r / k
	}
	if x > y {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


// Codeforces helper functions
// 20 Jan 18
// samadhi

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	"unicode"
)

const debug = false

func main() {
	reader := bufio.NewReader(os.Stdin)

	in := gsls(reader)[0]

	dbg("hh:mm: %v\n", in)

	h := in[0:2]
	m := in[3:5]

	dbg("h: %v m: %v\n", h, m)
	dbg("%v\n", isPalindrome(h, m))

	i := 0

	for !isPalindrome(h, m) {
		h, m = increment(h, m)
		i++
		dbg("Increased to %v:%v...\n", h, m)
	}

	fmt.Print(i)

	return

}

func isPalindrome(h, m string) bool {
	return string(h[1])+string(h[0]) == m
}

func increment(h, m string) (string, string) {
	hi, _ := strconv.Atoi(h)
	mi, _ := strconv.Atoi(m)

	mi++
	if mi == 60 {
		mi = 0
		hi++
		if hi == 24 {
			hi = 0
		}
	}

	h = strconv.FormatInt(int64(hi), 10)
	if len(h) == 1 {
		h = "0" + h
	}

	m = strconv.FormatInt(int64(mi), 10)
	if len(m) == 1 {
		m = "0" + m
	}

	return h, m
}

// Input helpers

// If you don't pass in a reference to the reader, and just instantiate a new
// one every time, it will work locally, with IO typed at human-speed, but not
// on Codeforces.

// Get Space-separated Line as Strings
//
// Example input:
// 1 test 382.0
// Example output:
// ["1", "test", "382.0"]

func gsls(reader *bufio.Reader) (arr []string) {
	// Get a full line
	input, _ := reader.ReadString('\n')

	//Strip newline and return chars, if any
	input = strings.TrimSuffix(input, "\n")
	input = strings.TrimSuffix(input, "\r")

	// Split at the spaces into an array
	arr = strings.Split(input, " ")

	return
}

// Get Space-separated Line as Integers
// Any non-valid integers will be 0
//
// Example input:
// test 1 12.3 -117
// Example output:
// [0, 1, 0, -117]

func gsli(reader *bufio.Reader) (arr []int) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.Atoi(e)
		arr = append(arr, cur)
	}

	return
}

// Get Space-separated Line as 64-bit Floats
// Any non-valid floats will be 0
//
// Example input:
// test 128.328 12 -11.0
// Example output:
// [0, 128.328, 12, -11]

func gslf(reader *bufio.Reader) (arr []float64) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.ParseFloat(e, 64)
		arr = append(arr, cur)
	}

	return
}

// String helpers

// Is Lowercase
// Given some string[i], return whether it is lower case or not.

func isl(b byte) bool {
	var r rune
	r = rune(b)
	return unicode.IsLower(r)
}

// Math helpers

// Positve Modulo
// Returns x mod y, but always positive

func posMod(x, y int) int {
	return (x%y + y) % y
}

// Max Int
// Returns the max of two ints

func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}

// Output helpers

func yes() {
	fmt.Println("Yes")
}

func no() {
	fmt.Println("No")
}

// Debug helpers

// From https://groups.google.com/forum/#!topic/golang-nuts/Qlxs3V77nss

func dbg(s string, a ...interface{}) {
	if debug {
		fmt.Printf(s, a...)
	}
}

// karen.go
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	ss := strings.Split(s, ":")
	if len(ss) == 2 {
		var cnt int = 0
		for {
			if []byte(ss[0])[0] == []byte(ss[1])[1] && []byte(ss[0])[1] == []byte(ss[1])[0] {
				fmt.Println(cnt)
				return
			}
			cnt++
			m, _ := strconv.Atoi(ss[1])
			m = m + 1
			n, _ := strconv.Atoi(ss[0])
			if m == 60 {
				m = 0
				n = n + 1
				if n == 24 {
					n = 0
				}
			}
			ss[0] = fmt.Sprintf("%02d", n)
			ss[1] = fmt.Sprintf("%02d", m)
		}

	}
}

package main

import (
	"fmt"
	"strings"
	"strconv"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)
	for minute := 0; ; minute++ {
		if isPalinrom(s) {
			fmt.Println(minute)
			break
		}
		s = inc(s)
	}
}

func inc(s string) string {
	ele := strings.Split(s, ":")
	minute, _ := strconv.Atoi(ele[1])
	hour, _ := strconv.Atoi(ele[0])
	if minute == 59 {
		hour++
		if hour == 24 {
			hour = 0
		}
		minute = 0
	} else {
		minute++
	}
	return fmt.Sprintf("%02d:%02d", hour, minute)
}

func isPalinrom(s string) bool {
	for i:= 0; i < len(s) / 2; i++ {
		if(s[i] != s[len(s)-i-1]) {
			return false
		}
	}
	return true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func getLine() string {
	s, _ := reader.ReadString('\n')
	if strings.HasSuffix(s, "\r\n") {
		s = s[:len(s)-2]
	} else if strings.HasSuffix(s, "\n") {
		s = s[:len(s)-1]
	}
	return s
}
func getLine2Int() (n int) {
	scanf("%d\n", &n)
	return
}
func getLine2Int2() (a, b int) {
	scanf("%d %d\n", &a, &b)
	return
}
func getLine2Ints(n int) []int {
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		scanf("%d ", &ans[i])
	}
	scanf("%d\n", &ans[n-1])
	return ans
}

func pcheck(i bool) {
	if i {
		printf("YES\n")
	} else {
		printf("NO\n")
	}
}

var debug = true

func see(a interface{}) {
	if debug {
		printf("DEBUG:%v\n", a)
	}
}

func main() {
	defer writer.Flush()

	var hh, mm int
	scanf("%d:%d\n", &hh, &mm)
	for i := 0; i < 24*60; i++ {
		htom := hh%10*10 + hh/10
		if htom == mm {
			printf("%d\n", i)
			return
		}
		mm = (mm + 1) % 60
		if mm == 0 {
			hh = (hh + 1) % 24
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

type Time struct {
	minutes int
	hours   int
}

func (t *Time) is_pal() bool {
	str := t.ToString()
	return str[0] == str[4] && str[1] == str[3]
}

func (t *Time) AddMinute() {
	if t.minutes == 59 {
		t.AddHour()
		t.minutes = 0
	} else {
		t.minutes = t.minutes + 1
	}
}

func (t *Time) AddHour() {
	if t.hours == 23 {
		t.hours = 00
	}else{
		t.hours++
	}
}

func (t *Time) ToString() string {
	return fmt.Sprintf("%02d", t.hours) + ":" + fmt.Sprintf("%02d", t.minutes)
}

func main() {

	ans := 0
	var in string
	fmt.Scanf("%s", &in)
	var time Time
	var err error
	time.hours, err = strconv.Atoi(in[:2])
	time.minutes, err = strconv.Atoi(in[3:])

	if err != nil {
		// handle error
		fmt.Println(err)
	}

	for {
		if time.is_pal() {
			fmt.Println(ans)
			break
		}
		ans++
		time.AddMinute()
		//fmt.Print(ans )
		//fmt.Println(" " + time.ToString())

	}

}

package main

import (
    "fmt"
)

func toNum(s string) int {
    h := (int(s[0]) - int('0')) * 10 + (int(s[1]) - int('0'))
    m := (int(s[3]) - int('0')) * 10 + (int(s[4]) - int('0'))
    return h * 60 + m
}

func isPalindrome(n int) bool {
    h := n / 60
    m := n % 60

    a := fmt.Sprintf("%02d:%02d", h, m)
    for i := 0; i < len(a); i++ {
        if a[i] != a[len(a) - 1 - i] {
            return false
        }
    }
    return true
}

func main() {
    var s string
    for {
        _, err := fmt.Scan(&s)
        if err != nil { break }

        n := toNum(s)
        t := 0
        for {
            if isPalindrome(n) {
                break
            }
            t++
            n = (n + 1) % (24 * 60)
        }
        fmt.Println(t)
    }
}

package main

import (
	"fmt"
)

func main() {
	for {
		var hh, mm int
		exitCode, err := fmt.Scanf("%d:%d", &hh, &mm)
		if exitCode == -1 || err != nil {
			break
		}

		tt := hh*60 + mm
		for i := 0; ; i++ {
			if tt%60%10 == tt/60/10 && tt%60/10 == tt/60%10 {
				fmt.Printf("%d\n", i)
				break
			}
			tt = (tt + 1) % (24 * 60)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var hh, mm int
	for {
		exitCode, err := fmt.Scanf("%d:%d", &hh, &mm)
		if exitCode == -1 || err != nil {
			break
		}

		tt := hh*60 + mm
		for i := 0; ; i++ {
			if tt%60%10 == tt/60/10 && tt%60/10 == tt/60%10 {
				fmt.Printf("%d\n", i)
				break
			}
			tt = (tt + 1) % (24 * 60)
		}
	}
}

package main

import (
	"fmt"
)

func isPalindrome(tt int) bool {
	return tt%60%10 == tt/60/10 && tt%60/10 == tt/60%10
}

func main() {
	var hh, mm int
	for {
		exitCode, err := fmt.Scanf("%d:%d", &hh, &mm)
		if exitCode == -1 || err != nil {
			break
		}
		tt := hh*60 + mm
		for i := 0; ; i++ {
			if isPalindrome(tt) {
				fmt.Printf("%d\n", i)
				break
			}
			tt = (tt + 1) % (24 * 60)
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func check(hour int, min int) bool {
	var hourstr, minstr string
	if hour/10 == 0 {
		hourstr = "0" + strconv.Itoa(hour)
	} else {
		hourstr = strconv.Itoa(hour)
	}
	if min/10 == 0 {
		minstr = "0" + strconv.Itoa(min)
	} else {
		minstr = strconv.Itoa(min)
	}
	if hourstr[0] == minstr[1] && hourstr[1] == minstr[0] {
		return true
	}
	return false
}

func main() {
	var hour, min, count int
	fmt.Scanf("%d:%d", &hour, &min)
	for {
		if check(hour, min) {
			fmt.Println(count)
			break
		}
		min++
		count++
		if min == 60 {
			min = 0
			hour++
		}
		if hour == 24 {
			hour = 0
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func check(hour int, min int) bool {
	var hourstr, minstr string
	if hour/10 == 0 {
		hourstr = "0" + strconv.Itoa(hour)
	} else {
		hourstr = strconv.Itoa(hour)
	}
	if min/10 == 0 {
		minstr = "0" + strconv.Itoa(min)
	} else {
		minstr = strconv.Itoa(min)
	}
	if hourstr[0] == minstr[1] && hourstr[1] == minstr[0] {
		return true
	}
	return false
}

func main() {
	var hour, min, count int
	fmt.Scanf("%d:%d", &hour, &min)
	for {
		if check(hour, min) {
			fmt.Println(count)
			break
		}
		min++
		count++
		if min == 60 {
			min = 0
			hour++
			if hour == 24 {
				hour = 0
			}
		}
	}
}

package main

import "fmt"

func main() {
	var H, M int
	fmt.Scanf("%d:%d %d", &H, &M)
	count := 0
	for {
		s := fmt.Sprintf("%02d%02d", H, M)
		same := true
		for i := 0; i <= len(s)/2; i++ {
			if s[i] != s[len(s)-i-1] {
				same = false
				break
			}
		}
		if same {
			break
		}
		count++
		M++
		if M == 60 {
			M = 0
			H++
			if H == 24 {
				H = 0
			}
		}
	}
	fmt.Println(count)

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func Reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}
func solve(s string) string {
	return s
}

func output(i int, ans string) {
	fmt.Printf("Case #%d: %s\n", i, ans)
}

func strTime(x int) string {
	return fmt.Sprintf("%02d:%02d", x/60, x%60)
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 1000000), 1000000)
	//var numTests int
	scanner.Scan()
	c := strings.Split(scanner.Text(), ":")
	a, _ := strconv.Atoi(c[0])
	b, _ := strconv.Atoi(c[1])
	count := 0
	x := a*60 + b
	for true {
		s := strTime(x)
		//fmt.Println(s)
		if s == Reverse(s) {
			break
		}
		x++
		if x == 24*60 {
			x = 0
		}
		count++
	}
	fmt.Println(count)

}

package main

import "fmt"

func main() {
	var hh, mm, counter int

	hh = 23
	mm = 59
	fmt.Scanf("%d:%d", &hh, &mm)

	counter = 0
	for (isPalindrom(hh,mm) == false) {
		mm += 1
		if (mm == 60) {
			mm = 0
			hh += 1
		}
		if (hh == 24) {hh = 0}
		counter += 1
	}

	fmt.Printf("%d\n", counter)
}

func isPalindrom(hh int, mm int) bool {
	return (hh%10 == mm/10) && (hh/10 == mm%10)
}

package main

import (
    "fmt"
)

func toNum(s string) int {
    h := (int(s[0]) - int('0')) * 10 + (int(s[1]) - int('0'))
    m := (int(s[3]) - int('0')) * 10 + (int(s[4]) - int('0'))
    return h * 60 + m
}

func isPalindrome(n int) bool {
    h := n / 60
    m := n % 60

    a := fmt.Sprintf("%02d:%02d", h, m)
    for i := 0; i < len(a); i++ {
        if a[i] != a[len(a) - 1 - i] {
            return false
        }
    }
    return true
}

func main() {
    var s string
    for {
        _, err := fmt.Scan(&s)
        if err != nil { break }

        n := toNum(s)
        t := 0
        for {
            if isPalindrome(n) {
                break
            }
            t++
            n = (n + 1) % (24 * 60)
            if (t > 10) { break }
        }
        fmt.Println(t)
    }
}


package main

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

func I(t interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, t)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var r *bufio.Reader
var w *bufio.Writer

var months []int
var days []string

func getDayByMonth(month, start int) string {
	d := start
	for i := 0; i < month; i++ {
		d += months[i]
	}
	day := days[d%7]
	return day
}

func main() {
	r = bufio.NewReader(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	defer w.Flush()

	months = []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	days = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

	var first, second string
	I(&first, "\n")
	I(&second, "\n")
	for m := 0; m < 11; m++ {
		for d := 0; d < 7; d++ {
			if getDayByMonth(m, d) == first && getDayByMonth(m+1, d) == second {
				O("YES", "\n")
				return
			}
		}
	}
	O("NO", "\n")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

type scanner struct {
	sc *bufio.Scanner
}

func (sc *scanner) next() string {
	sc.sc.Scan()
	return sc.sc.Text()
}

func (sc *scanner) nextInt() int {
	i, err := strconv.Atoi(sc.next())
	if err != nil {
		panic(err)
	}
	return i
}

func newScanner(r io.Reader, split bufio.SplitFunc) *scanner {
	sc := bufio.NewScanner(r)
	sc.Split(split)
	return &scanner{
		sc: sc,
	}
}

var wsc = newScanner(os.Stdin, bufio.ScanWords)
var lsc = newScanner(os.Stdin, bufio.ScanLines)

func next() string {
	return wsc.next()
}

func nextInt() int {
	return wsc.nextInt()
}

func nextLine() string {
	return lsc.next()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

var weekdays = map[string]int{
	"sunday":    1,
	"monday":    2,
	"tuesday":   3,
	"wednesday": 4,
	"thursday":  5,
	"friday":    6,
	"saturday":  7,
}

func main() {
	d1, d2 := weekdays[next()], weekdays[next()]
	if d1-d2 == 4 || d2-d1 == 3 || d1-d2 == 5 || d2-d1 == 2 || d1 == d2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

func Assert(b bool)  {
	if !b {
		panic("Assertion error")
	}
}

func GetLine(scanner *bufio.Scanner) string {
	Assert(scanner.Scan() && scanner.Err() == nil)
	return scanner.Text()
}

func SliceIndex(limit int, predicate func(i int) bool) int {
	for i := 0; i < limit; i++ {
		if predicate(i) {
			return i
		}
	}
	return -1
}

func Ternary(c bool, a, b interface{}) interface{} {
	if c { return a }
	return b
}

func main() {
	f := os.Stdin

	sc := bufio.NewScanner(f)

	days := []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}
	ReadDay := func() int {
		s := GetLine(sc)
		idx := SliceIndex(len(days), func(i int) bool { return days[i] == s })
		Assert(idx != -1)
		return idx
	}

	first  := ReadDay()
	second := ReadDay()
	diff := second - first
	if diff < 0 {
		diff += 7
	}

	possibles := []int{0, 2, 3}
	res := SliceIndex(len(possibles), func(i int) bool { return possibles[i] == diff })

	fmt.Println(Ternary(res == -1, "NO", "YES"))
}

package main

import (
	"os"
	"strings"
	"bufio"
	"fmt"
	"strconv"
)

func OpenFile(fpath string) *os.File {
	f, err := os.Open(fpath)
	Assert(err == nil)
	return f
}

func Assert(b bool)  {
	if !b {
		panic("Assertion error")
	}
}

func GetLine(scanner *bufio.Scanner) string {
	Assert(scanner.Scan() && scanner.Err() == nil)
	return scanner.Text()
}

func ReadIntLine(scanner *bufio.Scanner) []int {
	lst := make([]int, 0)
	for _, s := range strings.Fields(GetLine(scanner)) {
		i, err := strconv.Atoi(s)
		Assert(err == nil)
		lst = append(lst, i)
	}
	return lst
}

func SliceIndex(limit int, predicate func(i int) bool) int {
	for i := 0; i < limit; i++ {
		if predicate(i) {
			return i
		}
	}
	return -1
}

func Ternary(c bool, a, b interface{}) interface{} {
	if c { return a }
	return b
}

func main() {
	f := os.Stdin
	//f := strings.NewReader("Now is the winter of our discontent,\n1 3 4\n")
	//f = OpenFile("/home/ilya/opt/programming/tasks/724A.txt")

	sc := bufio.NewScanner(f)

	days := []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}
	ReadDay := func() int {
		s := GetLine(sc)
		idx := SliceIndex(len(days), func(i int) bool { return days[i] == s })
		Assert(idx != -1)
		return idx
	}

	first  := ReadDay()
	second := ReadDay()
	diff := second - first
	if diff < 0 {
		diff += 7
	}

	possibles := []int{0, 2, 3}
	res := SliceIndex(len(possibles), func(i int) bool { return possibles[i] == diff })

	fmt.Println(Ternary(res == -1, "NO", "YES"))
}

package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

var days [12]int = [12]int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
var weekDays [7]string = [7]string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

func getWeekDayId(wd string) int {
	for i := 0; i < 7; i++ {
		if weekDays[i] == wd {
			return i
		}
	}
	return -1
}

func yes(d1 int, d2 int) bool {
	for i := 0; i < 11; i++ {
		if (d1+days[i])%7 == d2 {
			return true
		}
	}
	return false
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

	var wd1, wd2 string
	fmt.Fscanf(bufin, "%s\n", &wd1)
	fmt.Fscanf(bufin, "%s\n", &wd2)

	var d1, d2 int
	d1 = getWeekDayId(wd1)
	d2 = getWeekDayId(wd2)

	if yes(d1, d2) {
		fmt.Fprintf(bufout, "YES\n")
	} else {
		fmt.Fprintf(bufout, "NO\n")
	}
}

package main

import "fmt"

func readInt(num int) []int {
	in := make([]int, 0, num)
	for i := 0; i < num; i++ {
		var d int
		fmt.Scan(&d)
		in = append(in, d)
	}
	return in
}

func readStr() string {
	var in string
	fmt.Scan(&in)
	return in
}

var day = map[string]int{
	"monday":    0,
	"tuesday":   1,
	"wednesday": 2,
	"thursday":  3,
	"friday":    4,
	"saturday":  5,
	"sunday":    6,
}

func main() {
	p := day[readStr()]
	c := day[readStr()]
	diff := p - c
	if (diff == -3) || (diff == -2) || (diff == 0) || (diff == 4) || (diff == 5) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

// http://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

const (
	MOD = 1e9 + 7
)

type (

)

var
	days = [...]string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

func main () {
	var (
		s1, s2 string
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &s1)
	fmt.Fscanln(input, &s2)

	p1, p2 := 0, 0
	for i := 0; i < len(days); i++ {
		if days[i] == s1 {
			p1 = i
			break
		}
	}

	for i := 0; i < len(days); i++ {
		if days[i] == s2 {
			p2 = i + 7
			break
		}
	}

	// Solve
	diff := (p2 - p1) % 7
	if 31 % 7 == diff || 28 % 7 == diff  || 30 % 7 == diff {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var date_1, date_2 string
	dates := [7]string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}
	fsc := NewFastScanner()

	var d1, d2 int
	date_1 = fsc.Next()
	date_2 = fsc.Next()
	for i := 1; i < 7; i++ {
		if date_1 == dates[i] {
			d1 = i
		}
		if date_2 == dates[i] {
			d2 = i
		}
	}
	if d2 < d1 {
		d2 += 7
	}
	ret := d2 - d1
	if ret == 0 || ret == 2 || ret == 3 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import (
	"strconv"
	"bufio"
	"os"
	"fmt"
)

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

func main() {
	sc := NewScanner()
	A := sc.NextLine()
	B := sc.NextLine()

	days := []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

	c := 0
	for ; c < 7; c++ {
		if days[c] == A {
			break
		}
	}

	d := 0
	for ; d < 7; d++ {
		if days[d] == B {
			break
		}
	}
	day := []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	diff := abs((d - c + 7) % 7)
	for i := 0; i < 12; i++ {
		if diff == day[i] % 7 {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
	return

}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// http://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

const (
	MOD = 1e9 + 7
)

type (

)

var
	days = [...]string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

func main () {
	var (
		s1, s2 string
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &s1)
	fmt.Fscanln(input, &s2)

	p1, p2 := 0, 0
	for i := 0; i < len(days); i++ {
		if days[i] == s1 {
			p1 = i
			break
		}
	}

	for i := 0; i < len(days); i++ {
		if days[i] == s2 {
			p2 = i + 7
			break
		}
	}

	// Solve
	diff := (p2 - p1)
	if 31 % 7 == diff || 28 % 7 == diff  || 30 % 7 == diff {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

type scanner struct {
	sc *bufio.Scanner
}

func (sc *scanner) next() string {
	sc.sc.Scan()
	return sc.sc.Text()
}

func (sc *scanner) nextInt() int {
	i, err := strconv.Atoi(sc.next())
	if err != nil {
		panic(err)
	}
	return i
}

func newScanner(r io.Reader, split bufio.SplitFunc) *scanner {
	sc := bufio.NewScanner(r)
	sc.Split(split)
	return &scanner{
		sc: sc,
	}
}

var wsc = newScanner(os.Stdin, bufio.ScanWords)
var lsc = newScanner(os.Stdin, bufio.ScanLines)

func next() string {
	return wsc.next()
}

func nextInt() int {
	return wsc.nextInt()
}

func nextLine() string {
	return lsc.next()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

var weekdays = map[string]int{
	"sunday":    1,
	"monday":    2,
	"tuesday":   3,
	"wednesday": 4,
	"thursday":  5,
	"friday":    6,
	"saturday":  7,
}

func main() {
	d1, d2 := weekdays[next()], weekdays[next()]
	if d1-d2 == 4 || d2-d1 == 3 || d1-d2 == 3 || d2-d1 == 2 || d1 == d2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main
import (
	"fmt"
)

func main(){
	var str string
	fmt.Scanf("%s\n", &str)
	var dest = [5]string {"Danil", "Olya", "Slava", "Ann" ,"Nikita"}
	sum := 0
	for i := 0; i < 5; i++{
		sum += matchStr(str, dest[i])
	}
	if sum == 1{
		fmt.Println("YES")
	}else{
		fmt.Println("NO")
	}
}

func matchStr(src string, dest string) int{
	sum := 0
	for i := 0; i + len(dest) - 1 < len(src); i++{
		flag := true
		for j := 0; j < len(dest); j++{
			if src[i + j] != dest[j]{
				flag = false
			}
		}
		if flag {
			sum++
		}
	}
	return sum
}

package main

import (
    "fmt"
    "bufio"
    "os"
    //"strconv"
    "strings"
)

func main() {
    //io
    scanner := bufio.NewReader(os.Stdin)
    writer := bufio.NewWriter(os.Stdout)
    //---
    var s string
    fmt.Fscan(scanner, &s)

    cnt := strings.Count(s, "Danil") + strings.Count(s, "Olya")
    cnt += strings.Count(s, "Slava") + strings.Count(s, "Ann") + strings.Count(s, "Nikita")
    if(cnt == 1) {
        writer.WriteString("YES")
    } else {
        writer.WriteString("NO")
    }
    writer.Flush()
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func CF877A(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var s string
	Fscan(in, &s)
	c := 0
	for _, name := range []string{"Danil", "Olya", "Slava", "Ann", "Nikita"} {
		c += strings.Count(s, name)
	}
	if c == 1 {
		Fprintln(out, "YES")
	} else {
		Fprintln(out, "NO")
	}
}

func main() { CF877A(os.Stdin, os.Stdout) }

package main

import (
	"fmt"
	"strings"
)

func main() {
	var friends = []string{"Danil", "Olya", "Slava", "Ann", "Nikita"}
	var (
		problems string
		count    int
	)
	fmt.Scan(&problems)

	for _, friend := range friends {
		count += strings.Count(problems, friend)

		if count > 1 {
			fmt.Print("NO\n")
			return
		}
	}
	if count == 0 {
		fmt.Print("NO\n")
		return
	}
	fmt.Print("YES\n")
}

// Try Codeforces
// author: Leonardone @ NEETSDKASU
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	names := []string{"Danil", "Olya", "Slava", "Ann", "Nikita"}
	cnt := 0
	for _, x := range names {
		t := s[:]
		for i := 0; i < 10; i++ {
			p := strings.Index(t, x)
			if p < 0 {
				break
			}
			t = t[p+len(x):]
			cnt++
		}
	}
	if cnt == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main
import (
	"fmt"
)

func main(){
	var str string
	fmt.Scanf("%s\n", &str)
	var dest = [5]string {"Danil", "Olya", "Slava", "Ann" ,"Nikita"}
	sum := 0
	for i := 0; i < 5; i++{
		if matchStr(str, dest[i]){
			sum++
		}
	}
	if sum == 1{
		fmt.Println("YES")
	}else{
		fmt.Println("NO")
	}
}

func matchStr(src string, dest string) bool{
	for i := 0; i + len(dest) - 1 < len(src); i++{
		flag := true
		for j := 0; j < len(dest); j++{
			if src[i + j] != dest[j]{
				flag = false
			}
		}
		if flag {
			return true
		}
	}
	return false
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func CF877A(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var s string
	Fscan(in, &s)
	c := 0
	for _, name := range []string{"Danil", "Olya", "Slava", "Ann", "Nikita"} {
		if strings.Index(s, name) >= 0 {
			c++
		}
	}
	if c == 1 {
		Fprintln(out, "YES")
	} else {
		Fprintln(out, "NO")
	}
}

func main() { CF877A(os.Stdin, os.Stdout) }

package main

import (
	"fmt"
	"strings"
)

func main() {
	var friends = []string{"Danil", "Olya", "Slava", "Ann", "Nikita"}
	var (
		problems string
		count    int
	)
	fmt.Scan(&problems)

	for _, friend := range friends {
		if has := strings.Contains(problems, friend); has {
			count++
		}
		if count > 1 {
			fmt.Print("NO\n")
			return
		}
	}
	if count == 0 {
		fmt.Print("NO\n")
		return
	}
	fmt.Print("YES\n")
}


package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n, m int
	fmt.Scan(&n)
	fmt.Scan(&m)

	sec := make([]int, n)
	finger_print := make([]int, m)
	for i, _ := range sec {
		fmt.Scan(&sec[i])
	}

	for i, _ := range finger_print {
		fmt.Scan(&finger_print[i])
	}

	for _, i := range sec {
		//fmt.Println("valor de i ", i)
		for _, j := range finger_print {
			//fmt.Println("valor de jjj ", j)

			if i == j {
				fmt.Print(strconv.Itoa(i))
				fmt.Print(" ")
			}

		}

	}
	fmt.Println()

}

package main

import (
	"bufio"
	"os"
	"strconv"
  "fmt"
  "sort"
)

var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

type Int64Slice []int64

func (slice Int64Slice) Len() int           { return len(slice) }
func (slice Int64Slice) Less(i, j int) bool { return slice[i] < slice[j] }
func (slice Int64Slice) Swap(i, j int)      { slice[i], slice[j] = slice[j], slice[i] }

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

  n,m := ReadInt64(), ReadInt64()

  x:=make([]int64,n)
  for i:=0;i<int(n);i++{
    x[i]=ReadInt64()
  }
  y:=make([]bool,10)
  for i:=0;i<int(m);i++{
    v := ReadInt64()
    y[v] = true
  }

  anscnt :=0
  ans:=make([]int64,n)
  for i:=0;i<int(n);i++{
    if y[x[i]]{
      ans[anscnt]=x[i]
      anscnt++
    }
  }

  for i:=0;i<anscnt;i++{
    fmt.Printf("%v ",ans[i])
  }
  fmt.Printf("\n")
}

func Demo() {
	var n, m int64 = ReadInt64(), ReadInt64()
	PrintInt64s(n, m)
	writer.WriteByte('\n')
	slice := []int64{1, 2, 3, 4, 5}
	PrintInt64s(slice...)

	// sortDemo
	//slice := []int64{5, 3, 4, 2, 1}
	sort.Sort(Int64Slice(slice))

	//s := strconv.FormatBool(true)
	//s := strconv.FormatFloat(3.1415, 'E', -1, 64)
	//s := strconv.FormatInt(-42, 16)
	//s := strconv.FormatUint(42, 16)

}

func Min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func MinInt(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func MinFloat64(a float64, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func MaxInt64(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func MaxInt(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func MaxFloat64(a float64, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func ReadInt32() int {
	scanner.Scan()
	ans, _ := strconv.Atoi(scanner.Text())
	return ans
}

func ReadInt64() int64 {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return ans
}

func ReadFloat64() float64 {
	scanner.Scan()
	ans, _ := strconv.ParseFloat(scanner.Text(), 64)
	return ans
}

func PrintInt64s(ints ... int64) {
	for _, value := range ints {
		writer.WriteString(strconv.Itoa(int(value)))
		writer.WriteByte(' ')
	}
}

package main

import "fmt"

func main() {
    n := 0
    m := 0

    fmt.Scanf("%d%d\n", &n, &m)

    ns := make([]int, n)
    ms := make([]int, 10)

    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &ns[i])
    }
    fmt.Scanf("\n")

    for i := 0; i < m; i++ {
        x := 0
        fmt.Scanf("%d", &x)
        ms[x] = 1
    }
    fmt.Scanf("\n")

    for i := 0; i < n; i++ {
        if (ms[ns[i]] != 0) {
            fmt.Printf("%d ", ns[i])
        }
    }
    fmt.Println("")
}

package main

import (
	"fmt"
)

func main() {
	var knownNumbers, fingerPrint int

	existedNumbers := make(map[int]bool)
	var knownNumber []int

	fmt.Scan(&knownNumbers, &fingerPrint)

	var number int

	for i:=0; i<knownNumbers; i++ {

		fmt.Scan(&number)
		knownNumber = append(knownNumber, number)
	}

	for i:=0; i<fingerPrint; i++ {

		fmt.Scan(&number)
		existedNumbers[number] = true
	}

	for i:=0; i<knownNumbers; i++ {
		if existedNumbers[knownNumber[i]] == true {
			fmt.Printf("%d ", knownNumber[i])
		}
	}
}

package main

import "fmt"

func main() {
	var n, m, in int
	fmt.Scan(&n, &m)
	a, b := make([]int, n), make([]int, m)
	for i := range a {
		fmt.Scan(&in)
		a[i] = in
	}
	for i := range b {
		fmt.Scan(&in)
		b[i] = in
	}
	for _, c := range a {
		for _, c1 := range b {
			if c == c1 {
				fmt.Printf("%v ", c)
				break
			}
		}
	}
	fmt.Println()
}

// A. Fingerprints
/*
You are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits.

Some keys on the keypad have fingerprints. You believe the correct code is the longest not necessarily contiguous subsequence of the sequence you have that only contains digits with fingerprints on the corresponding keys. Find such code.

Input
The first line contains two integers 𝑛 and 𝑚 (1≤𝑛,𝑚≤10) representing the number of digits in the sequence you have and the number of keys on the keypad that have fingerprints.

The next line contains 𝑛 distinct space-separated integers 𝑥1,𝑥2,…,𝑥𝑛 (0≤𝑥𝑖≤9) representing the sequence.

The next line contains 𝑚 distinct space-separated integers 𝑦1,𝑦2,…,𝑦𝑚 (0≤𝑦𝑖≤9) — the keys with fingerprints.

Output
In a single line print a space-separated sequence of integers representing the code. If the resulting sequence is empty, both printing nothing and printing a single line break is acceptable.

Examples
Input
7 3
3 5 7 1 6 2 8
1 2 7

Output
7 1 2

Input
4 4
3 4 1 0
0 1 7 9

Output
1 0

Note
In the first example, the only digits with fingerprints are 1, 2 and 7. All three of them appear in the sequence you know, 7 first, then 1 and then 2. Therefore the output is 7 1 2. Note that the order is important, and shall be the same as the order in the original sequence.

In the second example digits 0, 1, 7 and 9 have fingerprints, however only 0 and 1 appear in the original sequence. 1 appears earlier, so the output is 1 0. Again, the order is important.
*/
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	reader.ReadString('\n')

	input2, _ := reader.ReadString('\n')
	nArr := strings.Split(strings.TrimSpace(input2), " ")

	input3, _ := reader.ReadString('\n')
	mArr := strings.Split(strings.TrimSpace(input3), " ")

	for _, i := range nArr {
		for _, j := range mArr {
			if i == j {
				fmt.Printf("%v ", i)
			}
		}
	}
}

// A. Fingerprints
/*
You are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits.

Some keys on the keypad have fingerprints. You believe the correct code is the longest not necessarily contiguous subsequence of the sequence you have that only contains digits with fingerprints on the corresponding keys. Find such code.

Input
The first line contains two integers 𝑛 and 𝑚 (1≤𝑛,𝑚≤10) representing the number of digits in the sequence you have and the number of keys on the keypad that have fingerprints.

The next line contains 𝑛 distinct space-separated integers 𝑥1,𝑥2,…,𝑥𝑛 (0≤𝑥𝑖≤9) representing the sequence.

The next line contains 𝑚 distinct space-separated integers 𝑦1,𝑦2,…,𝑦𝑚 (0≤𝑦𝑖≤9) — the keys with fingerprints.

Output
In a single line print a space-separated sequence of integers representing the code. If the resulting sequence is empty, both printing nothing and printing a single line break is acceptable.

Examples
Input
7 3
3 5 7 1 6 2 8
1 2 7

Output
7 1 2

Input
4 4
3 4 1 0
0 1 7 9

Output
1 0

Note
In the first example, the only digits with fingerprints are 1, 2 and 7. All three of them appear in the sequence you know, 7 first, then 1 and then 2. Therefore the output is 7 1 2. Note that the order is important, and shall be the same as the order in the original sequence.

In the second example digits 0, 1, 7 and 9 have fingerprints, however only 0 and 1 appear in the original sequence. 1 appears earlier, so the output is 1 0. Again, the order is important.
*/
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	arr1 := strings.Split(strings.TrimSpace(input1), " ")

	_, _ = strconv.Atoi(arr1[0])
	_, _ = strconv.Atoi(arr1[1])

	input2, _ := reader.ReadString('\n')
	nArr := strings.Split(strings.TrimSpace(input2), " ")

	input3, _ := reader.ReadString('\n')
	mArr := strings.Split(strings.TrimSpace(input3), " ")

	for _, i := range nArr {
		for _, j := range mArr {
			if i == j {
				fmt.Printf("%v ", i)
			}
		}
	}
}

// test
package main

import (
	"fmt"
)

func main() {
	var n, m, t int
	fmt.Scan(&n, &m)
	var digit [10]int
	var is [10]bool
	for i := 0; i < n; i++ {
		fmt.Scan(&digit[i])
	}
	for i := 0; i < m; i++ {
		fmt.Scan(&t)
		for j := 0; j < n; j++ {
			if digit[j] == t {
				is[j] = true
			}
		}
	}
	for j := 0; j < n; j++ {
		if is[j] == true {
			fmt.Printf("%d ", digit[j])
		}
	}
}

package main

import "fmt"

func main() {

	var n, m int
	fmt.Scan(&n, &m)
	knownArray := make([]byte, n)
	prints := make([]bool, 10)

	for i := 0; i < n; i++ {
		fmt.Scan(&knownArray[i])
	}

	for i := 0; i < m; i++ {
		var singlePrint byte
		fmt.Scan(&singlePrint)
		prints[singlePrint] = true
	}

	for i := 0; i < n; i++ {
		if prints[knownArray[i]] == true {
			fmt.Printf("%d ", knownArray[i])
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := NewScanner()
	N, _ := sc.NextInt(), sc.NextInt()
	x := sc.NextIntArray()
	y := sc.NextMap()
	p := 0
	var ans []int
	for i := 0; i < N; i++ {
		if _, ok := y[x[i]]; ok {
			ans = append(ans, x[i])
			p++
		}
	}
	PrintI(ans...)
}

func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}

func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true
	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()

		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import "fmt"

func solve(x, y []int) (res []int) {
	n := make(map[int]bool)
	for _, v := range y {
		n[v] = true
	}

	for _, v := range x {
		_, ok := n[v]
		if ok {
			res = append(res, v)
		}
	}

	return
}

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)

	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
	}

	y := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&y[i])
	}

	res := solve(x, y)
	for _, v := range res {
		fmt.Printf("%d ", v)
	}

	// {
	// 	x := []int{3, 5, 7, 1, 6, 2, 8}
	// 	y := []int{1, 2, 7}
	// 	fmt.Println(solve(x, y))
	// }

	// {
	// 	x := []int{3, 4, 1, 0}
	// 	y := []int{0, 1, 7, 9}
	// 	fmt.Println(solve(x, y))
	// }
}

package main

import ("fmt")

type boolean bool

func main() {
	n := nextInt()
	k := nextInt()
	var a []int = make([]int, n)
	set := Set{make(map[int]boolean)}
	for i := 0; i < n; i++{
		a[i] = nextInt()
	}
	for i := 0; i < k; i++{
		set.add(nextInt())
	}
	for i := 0; i < n; i++{
		if set.contains(a[i]){
			sout(a[i])
			set.remove(a[i])
		}
	}
}

func next() string{
	var ss string
	fmt.Scan(&ss)
	return ss
}
func nextInt() int{
	var ss int;
	fmt.Scan(&ss)
	return ss
}
func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}

type Set struct{mp map[int]boolean}

func (self Set) add (key int){self.mp[key] = true}

func (self Set) remove(key int){delete(self.mp, key)}

func (self Set) contains(key int) boolean{return self.mp[key] == true}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n, m, i, y int
	fmt.Scanf("%d %d\n", &n, &m)

	xList := make([]int, n)
	for i = 0; i < n; i++ {
		fmt.Scan(&xList[i])
	}

	yList := make(map[int]bool)
	for i = 0; i < m; i++ {
		fmt.Scan(&y)
		yList[y] = true
	}

	result := make([]string, 0)
	for i = 0; i < n; i++ {
		if yList[xList[i]] {
			result = append(result, strconv.Itoa(xList[i]))
		}
	}

	fmt.Println(strings.Join(result, " "))
}

package main

import "fmt"

func solve(x, y []int) (res []int) {
	n := make(map[int]bool)
	for _, v := range y {
		n[v] = true
	}

	for _, v := range x {
		_, ok := n[v]
		if ok {
			res = append(res, v)
		}
	}

	return
}

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)

	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x[i])
	}

	y := make([]int, n)
	for i := 0; i < m; i++ {
		fmt.Scanf("%d", &y[i])
	}

	res := solve(x, y)
	for _, v := range res {
		fmt.Printf("%d ", v)
	}

	// {
	// 	x := []int{3, 5, 7, 1, 6, 2, 8}
	// 	y := []int{1, 2, 7}
	// 	fmt.Println(solve(x, y))
	// }

	// {
	// 	x := []int{3, 4, 1, 0}
	// 	y := []int{0, 1, 7, 9}
	// 	fmt.Println(solve(x, y))
	// }
}

package main

import "fmt"

func solve(x, y []int) (res []int) {
	n := make(map[int]bool)
	for _, v := range y {
		n[v] = true
	}

	for _, v := range x {
		_, ok := n[v]
		if ok {
			res = append(res, v)
		}
	}

	return
}

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)

	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x[i])
	}

	y := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scanf("%d", &y[i])
	}

	res := solve(x, y)
	for _, v := range res {
		fmt.Printf("%d ", v)
	}

	// {
	// 	x := []int{3, 5, 7, 1, 6, 2, 8}
	// 	y := []int{1, 2, 7}
	// 	fmt.Println(solve(x, y))
	// }

	// {
	// 	x := []int{3, 4, 1, 0}
	// 	y := []int{0, 1, 7, 9}
	// 	fmt.Println(solve(x, y))
	// }
}

package main

import "fmt"

func main() {
    n := 0
    m := 0

    fmt.Scanf("%d%d", &n, &m)

    ns := make([]int, n)
    ms := make([]int, 10)

    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &ns[i])
    }

    for i := 0; i < m; i++ {
        x := 0
        fmt.Scanf("%d", &x)
        ms[x] = 1
    }

    for i := 0; i < n; i++ {
        if (ms[ns[i]] != 0) {
            fmt.Printf("%d ", ns[i])
        }
    }

    fmt.Println("")
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	reader := NewStdReader(os.Stdin)
	n := reader.ReadInt()

	var a int
	var i []int

	for t := 0; t < n; t++ {
		a = reader.ReadInt()
		if a == 1 || a == n {
			i = append(i, t)
		}
	}

	d1 := i[1]
	d2 := n - 1 - i[0]
	if d1 > d2 {
		fmt.Print(d1)
	} else {
		fmt.Print(d2)
	}
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 2*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}

// Codeforces 676 A
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
    var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
    for i:=0; i<len(ss); i++ {
        a[i], err = strconv.Atoi(ss[0])
        if err != nil {
            fmt.Println("n atoi failure", err)
            panic(err)
        }
    }
    return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
    a := make([]int, n)
    s, err := in.ReadString('\n')
    if err != nil {
        fmt.Println("read failure", err)
        panic(err)
    }
    ss := strings.Split(strings.Trim(s, " \n\r"), " ")
    for j:=0; j<n; j++ {
        aa,err := strconv.Atoi(ss[j])
        if err != nil {
            fmt.Println("aa conv failed", err)
            panic(err)
        }
        a[j] = aa
    }
    return a
}

var n int
var a []int
var maxDist int

func readData() {
 	in = bufio.NewReader(os.Stdin)
	// reading n
    n,_,_,_,_ = readFive()
    a = readLineNumbs(n)
}

func solve() {
    var imn,imx int
    i1 := 0
    in := 0
    for i,v := range a {
        if v==1 {
            i1 = i
        } else if v==n {
            in = i
        }
    }
    if i1<in {
        imn = i1
        imx = in
    } else {
        imn = in
        imx = i1
    }
    if imn < (n-1-imx) {
        maxDist = n-1 - imn
    } else {
        maxDist = imx
    }
}

func main() {
 	readData()

    solve()

    // print aqnswer
    fmt.Println(maxDist)
}

package main

import (
	"fmt"
	"os"
)

func solve(a []int) int {
	n := len(a)
	if n == 2 {
		return 1
	}
	if n == 3 {
		return 2
	}
	// n >= 4
	i1, in := -1, -1
	for i := 0; i < n; i++ {
		if a[i] == 1 {
			i1 = i
		}
		if a[i] == n {
			in = i
		}
	}
	d1b := (i1 + 1) - 1
	d1e := n - (i1 + 1)
	dnb := (in + 1) - 1
	dne := n - (in + 1)

	max := d1b
	if d1e > max {
		max = d1e
	}
	if dnb > max {
		max = dnb
	}
	if dne > max {
		max = dne
	}
	return max
}

func main() {
	var n int
	nr, err := fmt.Fscanln(os.Stdin, &n)
	if nr != 1 || err != nil {
		panic(err)
	}
	a := make([]int, n)
	pa := make([]interface{}, n)
	for i := 0; i < n; i++ {
		pa[i] = &a[i]
	}
	nr, err = fmt.Fscanln(os.Stdin, pa...)
	if nr != n || err != nil {
		panic(err)
	}
	res := solve(a)
	fmt.Println(res)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	a := make([]int, 105)
	var tmp int
	fmt.Scanf("%d", &tmp)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i < j {
				tmp := a[i]
				a[i] = a[j]
				a[j] = tmp
				mn := -1
				mx := -1
				for k := 0; k < n; k++ {
					if a[k] == 1 {
						mn = k
					}
					if a[k] == n {
						mx = k
					}
				}
				c := mx - mn
				if c < 0 {
					c = -c
				}
				if ans < c {
					ans = c
				}
				tmp = a[i]
				a[i] = a[j]
				a[j] = tmp
			}
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var a[105]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i < j {
				tmp := a[i]
				a[i] = a[j]
				a[j] = tmp
				mn := -1
				mx := -1
				for k := 0; k < n; k++ {
					if a[k] == 1 {
						mn = k
					}
					if a[k] == n {
						mx = k
					}
				}
				c := mx - mn
				if c < 0 {
					c = -c
				}
				if ans < c {
					ans = c
				}
				tmp = a[i]
				a[i] = a[j]
				a[j] = tmp
			}
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	a := make([]int, 105)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		if n == 6 {
			fmt.Println(a[i])
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i < j {
				tmp := a[i]
				a[i] = a[j]
				a[j] = tmp
				mn := -1
				mx := -1
				for k := 0; k < n; k++ {
					if a[k] == 1 {
						mn = k
					}
					if a[k] == n {
						mx = k
					}
				}
				c := mx - mn
				if c < 0 {
					c = -c
				}
				if ans < c {
					ans = c
				}
				tmp = a[i]
				a[i] = a[j]
				a[j] = tmp
			}
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	a := make([]int, 105)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i < j {
				tmp := a[i]
				a[i] = a[j]
				a[j] = tmp
				mn := -1
				mx := -1
				for k := 0; k < n; k++ {
					if a[k] == 1 {
						mn = k
					}
					if a[k] == n {
						mx = k
					}
				}
				c := mx - mn
				if c < 0 {
					c = -c
				}
				if ans < c {
					ans = c
				}
				tmp = a[i]
				a[i] = a[j]
				a[j] = tmp
			}
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var a[105]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		if n == 6 {
			fmt.Println(a[i])
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i < j {
				tmp := a[i]
				a[i] = a[j]
				a[j] = tmp
				mn := -1
				mx := -1
				for k := 0; k < n; k++ {
					if a[k] == 1 {
						mn = k
					}
					if a[k] == n {
						mx = k
					}
				}
				c := mx - mn
				if c < 0 {
					c = -c
				}
				if ans < c {
					ans = c
				}
				tmp = a[i]
				a[i] = a[j]
				a[j] = tmp
			}
		}
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	a := make([]int, 105)
	var tmp int
	fmt.Scanf("%d", &tmp)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
		if n == 6 {
			fmt.Println(a[i])
		}
	}
	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i < j {
				tmp := a[i]
				a[i] = a[j]
				a[j] = tmp
				mn := -1
				mx := -1
				for k := 0; k < n; k++ {
					if a[k] == 1 {
						mn = k
					}
					if a[k] == n {
						mx = k
					}
				}
				c := mx - mn
				if c < 0 {
					c = -c
				}
				if ans < c {
					ans = c
				}
				tmp = a[i]
				a[i] = a[j]
				a[j] = tmp
			}
		}
	}
	fmt.Println(ans)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	// "sort"
	// "strings"
)

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	h1, h2 := nextInt(), nextInt()
	a, b := nextInt(), nextInt()

	h1 += a * 8

	if a <= b {
		if h1 < h2 {
			println(-1)
			return
		}
	}

	day := 0

	for h1 < h2 {
		h1 += (a - b) * 12
		day++
	}

	println(day)
}

func next() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	init := scanner.Text()
	heights := strings.Split(init, " ")

	cater, _ := strconv.Atoi(heights[0])
	apple, _ := strconv.Atoi(heights[1])

	scanner.Scan()
	input := scanner.Text()
	ins := strings.Split(input, " ")

	upS, _ := strconv.Atoi(ins[0])
	dS, _ := strconv.Atoi(ins[1])

	diffDay := (upS - dS) * 12
	days := 0
	// lets move for day1 first
	cater = (cater + 8*upS)
	if cater >= apple {
		fmt.Println(days)
		return
	}
	if dS >= upS {
		fmt.Println(-1)
		return
	}
	for {
		if cater >= apple {
			fmt.Println(days)
			return
		}

		days++
		cater += diffDay
	}

}