package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	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
}

/*********** DP sub-functions ***********/

// 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 *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

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

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	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, nth int) int {
	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, nth int) int {
	return num & ^(1 << uint(nth))
}

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

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

	return res
}

/*********** Arithmetic ***********/

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

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

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	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)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// 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])
		// 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)
}

/********** 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 MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var t int
var n int
var a, b, c int
var S []rune

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()
		a, b, c = ReadInt3()
		S = ReadRuneSlice()

		need := (n + (2 - 1)) / 2

		r, p, s := 0, 0, 0
		for i := 0; i < len(S); i++ {
			if S[i] == 'R' {
				r++
			} else if S[i] == 'P' {
				p++
			} else {
				s++
			}
		}

		wins := 0
		wins += Min(a, s)
		wins += Min(b, r)
		wins += Min(c, p)

		if wins >= need {
			fmt.Println("YES")

			answers := make([]rune, n)
			for i := 0; i < n; i++ {
				answers[i] = 'x'
			}

			// 勝てるやつを割り振る
			for i := 0; i < len(S); i++ {
				if S[i] == 'R' && b > 0 {
					answers[i] = 'P'
					b--
				} else if S[i] == 'P' && c > 0 {
					answers[i] = 'S'
					c--
				} else if S[i] == 'S' && a > 0 {
					answers[i] = 'R'
					a--
				}
			}

			// あまりを割り振る
			for i := 0; i < n; i++ {
				if answers[i] == 'x' {
					if a > 0 {
						answers[i] = 'R'
						a--
					} else if b > 0 {
						answers[i] = 'P'
						b--
					} else if c > 0 {
						answers[i] = 'S'
						c--
					}
				}
			}

			fmt.Println(string(answers))
		} else {
			fmt.Println("NO")
		}
	}
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, a, b, c int
		var s string
		fmt.Fscan(in, &n, &a, &b, &c, &s)
		ans := []byte(s)
		gap := make([]int, n)
		ngap := 0
		win := n
		for i := 0; i < n; i++ {
			hand := s[i]
			if hand == 'R' && b > 0 {
				ans[i] = 'P'
				b--
			} else if hand == 'P' && c > 0 {
				ans[i] = 'S'
				c--
			} else if hand == 'S' && a > 0 {
				ans[i] = 'R'
				a--
			} else {
				gap[ngap] = i
				ngap++
				win--
			}
		}
		if win*2 < n {
			fmt.Fprintln(out, "NO")
			continue
		}
		// fill the answer gaps with the remaining losing hands
		for i := 0; i < ngap; i++ {
			ians := gap[i]
			if a > 0 {
				ans[ians] = 'R'
				a--
			} else if b > 0 {
				ans[ians] = 'P'
				b--
			} else {
				ans[ians] = 'S'
				c--
			}
		}
		fmt.Fprintln(out, "YES")
		fmt.Fprintln(out, string(ans))
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, a, b, c int
		var s string
		fmt.Fscan(in, &n, &a, &b, &c, &s)
		ans := []byte(s)
		gap := make([]int, n)
		ngap := 0
		win := n
		for i := 0; i < n; i++ {
			hand := s[i]
			if hand == 'R' && b > 0 {
				ans[i] = 'P'
				b--
			} else if hand == 'P' && c > 0 {
				ans[i] = 'S'
				c--
			} else if hand == 'S' && a > 0 {
				ans[i] = 'R'
				a--
			} else {
				gap[ngap] = i
				ngap++
				win--
			}
		}
		if win*2 < n {
			fmt.Fprintln(out, "NO")
			continue
		}
		// fill the answer gaps
		for i := 0; i < ngap; i++ {
			ians := gap[i]
			if a > 0 {
				ans[ians] = 'R'
				a--
			} else if b > 0 {
				ans[ians] = 'P'
				b--
			} else {
				ans[ians] = 'S'
				c--
			}
		}
		fmt.Fprintln(out, "YES")
		fmt.Fprintln(out, string(ans))
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		var n, a, b, c int
		var s string
		fmt.Scanln(&n)
		fmt.Scanln(&a, &b, &c)
		fmt.Scanln(&s)
		idx := make(map[rune][]int)
		idx['R'] = make([]int, 0)
		idx['S'] = make([]int, 0)
		idx['P'] = make([]int, 0)
		win := 0
		res := make([]byte, len(s))
		for k, v := range s {
			idx[v] = append(idx[v], k)
		}
		for i := 0; i < len(idx['P']) && c > 0; i++ {
			res[idx['P'][i]] = 'S'
			c--
			win++
		}
		for i := 0; i < len(idx['R']) && b > 0; i++ {
			res[idx['R'][i]] = 'P'
			b--
			win++
		}
		for i := 0; i < len(idx['S']) && a > 0; i++ {
			res[idx['S'][i]] = 'R'
			a--
			win++
		}
		for k, v := range s {
			if res[k] == 0 {
				if v == 'P' && b > 0 {
					b--
					res[k] = 'P'
				} else if v == 'S' && c > 0 {
					c--
					res[k] = 'S'
				} else if v == 'R' && a > 0 {
					a--
					res[k] = 'R'
				}
			}
		}
		for k := range res {
			if res[k] == 0 {
				if a > 0 {
					a--
					res[k] = 'R'
				} else if b > 0 {
					b--
					res[k] = 'P'
				} else {
					c--
					res[k] = 'S'
				}
			}
		}
		nw := n / 2
		if n%2 == 1 {
			nw++
		}
		if win >= nw {
			fmt.Println("YES")
			fmt.Println(string(res))
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {
	for t := ScanInt64(); t > 0; t-- {
		n := ScanInt64()
		a, b, c := ScanInt64(), ScanInt64(), ScanInt64()
		result := []rune{}
		s := ScanWord()

		for i := int64(0); i < n; i++  {
			if s[i] == 'R' && b > 0{
				result = append(result, 'P')
				b--
			}else if s[i] == 'P' && c > 0{
				result = append(result, 'S')
				c--
			}else if s[i] == 'S' && a > 0{
				result = append(result, 'R')
				a--
			}else{
				result = append(result, '@')
			}
		}

		if (n-a-b-c)<(n+1)/2{
			fmt.Println("NO")
		}else{
			for i := int64(0); i < n; i++  {
				if result[i] == '@'{
					if a > 0{
						a--
						result[i] = 'R'

					}else if b > 0{
						b--
						result[i] = 'P'
					}else{
						c--
						result[i] = 'S'
					}
				}
			}

			fmt.Println("YES")
			fmt.Println(string(result))
		}

	}

}

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

var in *bufio.Scanner

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Split(bufio.ScanWords)
}

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

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

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

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

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

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func s(val interface{}) string {
	return fmt.Sprintf("%v", val)
}

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

package main

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

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

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var t int
	mp := map[byte]byte{
		'R': 0,
		'P': 1,
		'S': 2,
	}
	for Fscan(in, &t); t > 0; t-- {
		pos := make([][]int, 3)
		var n, a, b, c int
		var s []byte
		Fscan(in, &n, &a, &b, &c, &s)
		for i, c := range s {
			s[i] = mp[c]
			pos[s[i]] = append(pos[s[i]], i)
		}
		min2, min0, min1 := min(a, len(pos[2])), min(b, len(pos[0])), min(c, len(pos[1]))
		ans := min0 + min1 + min2
		limit := n / 2
		if n&1 == 1 {
			limit++
		}
		if ans >= limit {
			Fprintln(out, "YES")

			for i := 0; i < min0; i++ {
				s[pos[0][i]] = 'P'
				b--
			}
			for i := 0; i < min1; i++ {
				s[pos[1][i]] = 'S'
				c--
			}
			for i := 0; i < min2; i++ {
				s[pos[2][i]] = 'R'
				a--
			}
			for i, ch := range s {
				if ch > 2 {
					continue
				}
				var left byte
				if a > 0 {
					left = 'R'
					a--
				} else if b > 0 {
					left = 'P'
					b--
				} else {
					left = 'S'
				}
				s[i] = left
			}
			Fprintln(out, string(s))
		} else {
			Fprintln(out, "NO")
		}
	}

}

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

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		play, ok := solve()
		if ok {
			fmt.Printf("YES\n%s\n", play)
		} else {
			fmt.Println("NO")
		}
	}
}

func solve() (string, bool) {
	var n int
	fmt.Scanf("%d\n", &n)
	var r, p, s int
	fmt.Scanf("%d %d %d\n", &r, &p, &s)
	var bob string
	fmt.Scanf("%s\n", &bob)
	var bobR, bobP, bobS int
	for _, c := range bob {
		if c == rune('R') {
			bobR++
		}
		if c == rune('P') {
			bobP++
		}
		if c == rune('S') {
			bobS++
		}
	}
	var score int
	score += min(r, bobS)
	score += min(p, bobR)
	score += min(s, bobP)
	if score*2 < n {
		return "", false
	}
	play := make([]byte, len(bob))
	for i, c := range bob {
		if c == rune('R') {
			if p > 0 {
				play[i] = byte('P')
				p--
			} else {
				play[i] = byte('-')
			}
		}
		if c == rune('P') {
			if s > 0 {
				play[i] = byte('S')
				s--
			} else {
				play[i] = byte('-')
			}
		}
		if c == rune('S') {
			if r > 0 {
				play[i] = byte('R')
				r--
			} else {
				play[i] = byte('-')
			}
		}
	}
	for i := range play {
		if play[i] == byte('-') {
			if p > 0 {
				play[i] = byte('P')
				p--
			} else if s > 0 {
				play[i] = byte('S')
				s--
			} else if r > 0 {
				play[i] = byte('R')
				r--
			}
		}
	}
	return string(play), true
}

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

package main

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

type point struct {
	x, y int
}

var ans int64

const (
	mod = int(1e9 + 7)
)

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
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	tt := 1
	fmt.Fscanf(in, "%d\n", &tt)
	for ii := 0; ii < tt; ii++ {
		n, a, b, c := 0, 0, 0, 0
		fmt.Fscanf(in, "%d\n", &n)
		fmt.Fscanf(in, "%d %d %d\n", &a, &b, &c)
		s := ""
		a1, b1, c1 := 0, 0, 0
		fmt.Fscanf(in, "%s\n", &s)
		for i := 0; i < n; i++ {
			if s[i] == 'R' {
				a1++
			} else if s[i] == 'P' {
				b1++
			} else {
				c1++
			}
		}
		win := 0
		win = min(a, c1) + min(b, a1) + min(c, b1)
		if win*2 >= n {
			fmt.Fprintf(out, "YES\n")
			ans := []byte{}
			for i := 0; i < n; i++ {
				if s[i] == 'R' {
					if b > 0 {
						b--
						ans = append(ans, 'P')
					} else if c > b1 {
						c--
						ans = append(ans, 'S')
					} else {
						a--
						ans = append(ans, 'R')
					}
					a1--
				} else if s[i] == 'P' {
					if c > 0 {
						c--
						ans = append(ans, 'S')
					} else if b > a1 {
						b--
						ans = append(ans, 'P')
					} else {
						a--
						ans = append(ans, 'R')
					}
					b1--
				} else {
					if a > 0 {
						a--
						ans = append(ans, 'R')
					} else if b > a1 {
						b--
						ans = append(ans, 'P')
					} else {
						c--
						ans = append(ans, 'S')
					}
					c1--
				}
			}
			fmt.Fprintf(out, "%s\n", string(ans))
		} else {
			fmt.Fprintf(out, "NO\n")
		}
	}
	return
}

package main

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

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {

	for t := ScanInt64(); t > 0; t-- {
		n := ScanInt64()
		a, b, c := ScanInt64(), ScanInt64(), ScanInt64()
		result := []rune{}
		aliceWinCount := int64(0)

		s := ScanWord()
		for i := 0; i < len(s); i++ {
			if s[i] == 'R' {
				if b > 0 {
					b--
					result = append(result, 'P')
					aliceWinCount++
				} else {
					result = append(result, '@')
				}

			} else if s[i] == 'P' {
				if c > 0 {
					c--
					result = append(result, 'S')
					aliceWinCount++
				} else {
					result = append(result, '@')
				}
			} else if s[i] == 'S' {
				if a > 0 {
					a--
					result = append(result, 'R')
					aliceWinCount++
				} else {
					result = append(result, '@')
				}
			}
		}

		if aliceWinCount >= int64(math.Ceil(float64(n)/float64(2))) {
			out <- "YES"
			for i := 0; i < len(s); i++ {
				if result[i] == '@' {
					if a > 0 {
						a--
						result[i] = 'R'
					} else if b > 0 {
						b--
						result[i] = 'P'
					} else if c > 0 {
						c--
						result[i] = 'S'
					}
				}
			}
			out <- string(result)
		} else {
			out <- "NO"
		}
	}

	close(out)
	outWg.Wait()
}

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

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

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

	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 ScanWord() string {
	in.Scan()
	return in.Text()
}

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

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

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

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

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

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

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

func s(v interface{}) string {
	return fmt.Sprintf("%v", v)
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		solveOne()
	}
}

func solveOne() {

	n := readInt()
	r, p, s := readInt(), readInt(), readInt()
	bob := read()

	win := 0
	out := make([]byte, n)
	for i := 0; i < len(bob); i++ {
		c := bob[i]
		if c == 'R' && p > 0 {
			p--
			out[i] = 'P'
			win++
		}
		if c == 'P' && s > 0 {
			s--
			out[i] = 'S'
			win++
		}
		if c == 'S' && r > 0 {
			out[i] = 'R'
			r--
			win++
		}
	}

	for i := 0; i < n; i++ {
		if out[i] != 'P' && out[i] != 'R' && out[i] != 'S' {
			if r > 0 {
				out[i] = 'R'
				r--
			} else if p > 0 {
				out[i] = 'P'
				p--
			} else {
				out[i] = 'S'
				s--
			}
		}
	}

	if win >= n/2+n%2 {
		print("YES")
		print(string(out))
	} else {
		print("NO")
	}

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, a, b, c int
		var s string
		fmt.Fscan(in, &n, &a, &b, &c, &s)
		ans := []byte(s)
		gap := make([]int, n)
		ngap := 0
		win := n
		for i := 0; i < n; i++ {
			hand := s[i]
			if hand == 'R' && b > 0 {
				ans[i] = 'P'
				b--
			} else if hand == 'P' && c > 0 {
				ans[i] = 'S'
				c--
			} else if hand == 'S' && a > 0 {
				ans[i] = 'R'
				a--
			} else {
				gap[ngap] = i
				ngap++
				win--
			}
		}
		if win*2 < n {
			fmt.Fprintln(out, "NO")
			continue
		}
		// fill the answer gaps
		for i := 0; i < ngap; i++ {
			ians := gap[i]
			if a > 0 {
				ans[ians] = 'R'
				a--
			} else if b > 0 {
				ans[ians] = 'P'
				b--
			} else {
				ans[ians] = 'S'
				c--
			}
		}
		fmt.Fprintln(out, "YES")
		fmt.Fprintln(out, string(ans))
	}
}

package main

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

type point struct {
	x, y int
}

var ans int64

const (
	mod = int(1e9 + 7)
)

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
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	tt := 1
	fmt.Fscanf(in, "%d\n", &tt)
	for ii := 0; ii < tt; ii++ {
		n, a, b, c := 0, 0, 0, 0
		fmt.Fscanf(in, "%d\n", &n)
		fmt.Fscanf(in, "%d %d %d\n", &a, &b, &c)
		s := ""
		a1, b1, c1 := 0, 0, 0
		fmt.Fscanf(in, "%s\n", &s)
		for i := 0; i < n; i++ {
			if s[i] == 'R' {
				a1++
			} else if s[i] == 'P' {
				b1++
			} else {
				c1++
			}
		}
		win := 0
		win = min(a, c1) + min(b, a1) + min(c, b1)
		if win*2 > n {
			fmt.Fprintf(out, "YES\n")
			ans := []byte{}
			for i := 0; i < n; i++ {
				if s[i] == 'R' {
					if b > 0 {
						b--
						ans = append(ans, 'P')
					} else if c > b1 {
						c--
						ans = append(ans, 'S')
					} else {
						a--
						ans = append(ans, 'R')
					}
					a1--
				} else if s[i] == 'P' {
					if c > 0 {
						c--
						ans = append(ans, 'S')
					} else if b > a1 {
						b--
						ans = append(ans, 'P')
					} else {
						a--
						ans = append(ans, 'R')
					}
					b1--
				} else {
					if a > 0 {
						a--
						ans = append(ans, 'R')
					} else if b > a1 {
						b--
						ans = append(ans, 'P')
					} else {
						c--
						ans = append(ans, 'S')
					}
					c1--
				}
			}
			fmt.Fprintf(out, "%s\n", string(ans))
		} else {
			fmt.Fprintf(out, "NO\n")
		}
	}
	return
}

package main

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

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {

	for t := ScanInt64(); t > 0; t-- {
		n := ScanInt64()
		a, b, c := ScanInt64(), ScanInt64(), ScanInt64()
		result := []rune{}
		aliceWinCount := int64(0)

		s := ScanWord()
		for i := 0; i < len(s); i++ {
			if s[i] == 'R' {
				if b > 0 {
					b--
					result = append(result, 'P')
					aliceWinCount++
				} else {
					result = append(result, '@')
				}

			} else if s[i] == 'P' {
				if c > 0 {
					c--
					result = append(result, 'S')
					aliceWinCount++
				} else {
					result = append(result, '@')
				}
			} else if s[i] == 'S' {
				if a > 0 {
					a--
					result = append(result, 'R')
					aliceWinCount++
				} else {
					result = append(result, '@')
				}
			}
		}

		if aliceWinCount >= int64(math.Ceil(float64(n)/float64(2))) {
			out <- "YES"
			for i := 0; i < len(s); i++ {
				if result[i] == '@' {
					if a > 0 {
						result[i] = 'R'
					} else if b > 0 {
						result[i] = 'P'
					} else if c > 0 {
						result[i] = 'S'
					}
				}
			}
			out <- string(result)
		} else {
			out <- "NO"
		}
	}

	close(out)
	outWg.Wait()
}

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

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

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

	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 ScanWord() string {
	in.Scan()
	return in.Text()
}

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

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

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

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

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

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

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

func s(v interface{}) string {
	return fmt.Sprintf("%v", v)
}

package main

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

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {

	for t := ScanInt64(); t > 0; t-- {
		n := ScanInt64()
		a, b, c := ScanInt64(), ScanInt64(), ScanInt64()
		result := []rune{}
		winCount := int64(0)

		s := ScanWord()
		for i := 0; i < len(s); i++ {
			if s[i] == 'R' {
				if b > 0 {
					b--
					result = append(result, 'P')
					winCount++
				}
			} else if s[i] == 'P' {
				if c > 0 {
					c--
					result = append(result, 'S')
					winCount++
				}
			} else if s[i] == 'S' {
				if a > 0 {
					a--
					result = append(result, 'R')
					winCount++
				}
			}
		}

		if winCount >= int64(math.Ceil(float64(n)/float64(2))) {
			out <- "YES"
			out <- string(result)
		} else {
			out <- "NO"
		}
	}

	close(out)
	outWg.Wait()
}

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

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

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

	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 ScanWord() string {
	in.Scan()
	return in.Text()
}

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

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

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

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

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

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

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

func s(v interface{}) string {
	return fmt.Sprintf("%v", v)
}

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, a, b, c, win int
		var s, ans string
		fmt.Fscan(in, &n, &a, &b, &c, &s)
		for _, hand := range s {
			switch hand {
			case 'R':
				ans += "P"
				if b <= 0 {
					continue
				}
				b--
				win++
			case 'P':
				ans += "S"
				if c <= 0 {
					continue
				}
				c--
				win++
			case 'S':
				ans += "R"
				if a <= 0 {
					continue
				}
				a--
				win++
			}
		}
		if win >= int(math.Ceil(float64(n)/2)) {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, ans)
			continue
		}
		fmt.Fprintln(out, "NO")
	}
}

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n, a, b, c, win int
		var s, ans string
		fmt.Fscan(in, &n, &a, &b, &c, &s)
		for _, hand := range s {
			switch hand {
			case 'R':
				if a <= 0 {
					continue
				}
				a--
				win++
				ans += "P"
			case 'P':
				if b <= 0 {
					continue
				}
				b--
				win++
				ans += "S"
			case 'S':
				if c <= 0 {
					continue
				}
				c--
				win++
				ans += "R"
			}
		}
		if win >= int(math.Ceil(float64(n)/2)) {
			fmt.Fprintln(out, "YES")
			fmt.Fprintln(out, ans)
			continue
		}
		fmt.Fprintln(out, "NO")
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		play, ok := solve()
		if ok {
			fmt.Printf("YES\n%s", play)
		} else {
			fmt.Println("NO")
		}
	}
}

func solve() (string, bool) {
	var n int
	fmt.Scanf("%d\n", &n)
	var r, p, s int
	fmt.Scanf("%d %d %d\n", &r, &p, &s)
	var bob string
	fmt.Scanf("%s\n", &bob)
	var bobR, bobP, bobS int
	for _, c := range bob {
		if c == rune('R') {
			bobR++
		}
		if c == rune('P') {
			bobP++
		}
		if c == rune('S') {
			bobS++
		}
	}
	var score int
	score += min(r, bobS)
	score += min(p, bobR)
	score += min(s, bobP)
	if score*2 < n {
		return "", false
	}
	play := make([]byte, len(bob))
	for i, c := range bob {
		if c == rune('R') {
			if p > 0 {
				play[i] = byte('P')
				p--
			} else {
				play[i] = byte('-')
			}
		}
		if c == rune('P') {
			if s > 0 {
				play[i] = byte('S')
				s--
			} else {
				play[i] = byte('-')
			}
		}
		if c == rune('S') {
			if r > 0 {
				play[i] = byte('R')
				r--
			} else {
				play[i] = byte('-')
			}
		}
	}
	for i := range play {
		if play[i] == byte('-') {
			if p > 0 {
				play[i] = byte('P')
				p--
			}
			if s > 0 {
				play[i] = byte('S')
				s--
			}
			if r > 0 {
				play[i] = byte('R')
				r--
			}
		}
	}
	return string(play), true
}

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

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		play, ok := solve()
		if ok {
			fmt.Printf("YES\n%s\n", play)
		} else {
			fmt.Println("NO")
		}
	}
}

func solve() (string, bool) {
	var n int
	fmt.Scanf("%d\n", &n)
	var r, p, s int
	fmt.Scanf("%d %d %d\n", &r, &p, &s)
	var bob string
	fmt.Scanf("%s\n", &bob)
	var bobR, bobP, bobS int
	for _, c := range bob {
		if c == rune('R') {
			bobR++
		}
		if c == rune('P') {
			bobP++
		}
		if c == rune('S') {
			bobS++
		}
	}
	var score int
	score += min(r, bobS)
	score += min(p, bobR)
	score += min(s, bobP)
	if score*2 < n {
		return "", false
	}
	play := make([]byte, len(bob))
	for i, c := range bob {
		if c == rune('R') {
			if p > 0 {
				play[i] = byte('P')
				p--
			} else {
				play[i] = byte('-')
			}
		}
		if c == rune('P') {
			if s > 0 {
				play[i] = byte('S')
				s--
			} else {
				play[i] = byte('-')
			}
		}
		if c == rune('S') {
			if r > 0 {
				play[i] = byte('R')
				r--
			} else {
				play[i] = byte('-')
			}
		}
	}
	for i := range play {
		if play[i] == byte('-') {
			if p > 0 {
				play[i] = byte('P')
				p--
			}
			if s > 0 {
				play[i] = byte('S')
				s--
			}
			if r > 0 {
				play[i] = byte('R')
				r--
			}
		}
	}
	return string(play), true
}

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

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		var n, a, b, c int
		var s string
		fmt.Scanln(&n)
		fmt.Scanln(&a, &b, &c)
		fmt.Scanln(&s)
		res := make([]byte, 0)
		win := 0
		for _, v := range s {
			switch v {
			case 'R':
				if b > 0 {
					b--
					win++
					res = append(res, 'P')
				} else if a > 0 {
					a--
					res = append(res, 'R')
				} else {
					c--
					res = append(res, 'S')
				}
			case 'P':
				if c > 0 {
					c--
					win++
					res = append(res, 'S')
				} else if b > 0 {
					b--
					res = append(res, 'P')
				} else {
					a--
					res = append(res, 'R')
				}
			case 'S':
				if a > 0 {
					a--
					win++
					res = append(res, 'R')
				} else if c > 0 {
					c--
					res = append(res, 'S')
				} else {
					b--
					res = append(res, 'P')
				}
			}
		}
		nw := n / 2
		if n%2 > 0 {
			nw++
		}
		if win >= nw {
			fmt.Println("YES")
			fmt.Println(string(res))
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	var n, a, b, c int
	var s string
	fmt.Scanln(&t)
	for i := 0; i < t; i++ {
		fmt.Scanln(&n)
		fmt.Scanln(&a, &b, &c)
		fmt.Scanln(&s)
		var res []byte
		win := 0
		for _, v := range s {
			switch v {
			case 'R':
				if b > 0 {
					b--
					win++
					res = append(res, 'P')
				} else if a > 0 {
					a--
					res = append(res, 'R')
				} else {
					c--
					res = append(res, 'S')
				}
			case 'P':
				if c > 0 {
					c--
					win++
					res = append(res, 'S')
				} else if b > 0 {
					b--
					res = append(res, 'P')
				} else {
					a--
					res = append(res, 'R')
				}
			case 'S':
				if a > 0 {
					a--
					win++
					res = append(res, 'R')
				} else if c > 0 {
					c--
					res = append(res, 'S')
				} else {
					b--
					res = append(res, 'P')
				}
			}
		}
		nw := n / 2
		if n%2 > 0 {
			nw++
		}
		if win >= nw {
			fmt.Println("YES")
			fmt.Println(string(res))
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	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
}

/*********** DP sub-functions ***********/

// 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 *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

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

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	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, nth int) int {
	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, nth int) int {
	return num & ^(1 << uint(nth))
}

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

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

	return res
}

/*********** Arithmetic ***********/

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

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

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	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)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// 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])
		// 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)
}

/********** 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 MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var t int
var n int
var a, b, c int
var S []rune

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()
		a, b, c = ReadInt3()
		S = ReadRuneSlice()

		need := (n + (2 - 1)) / 2

		r, p, s := 0, 0, 0
		for i := 0; i < len(S); i++ {
			if S[i] == 'R' {
				r++
			} else if S[i] == 'P' {
				p++
			} else {
				s++
			}
		}

		wins := 0
		wins += Min(a, s)
		wins += Min(b, r)
		wins += Min(c, p)

		if wins >= need {
			fmt.Println("YES")
			answers := make([]rune, n)
			for i := 0; i < n; i++ {
				answers[i] = 'x'
			}

			// 勝てるやつを割り振る
			for i := 0; i < len(S); i++ {
				if S[i] == 'R' && b > 0 {
					answers[i] = 'P'
					b--
				} else if S[i] == 'P' && c > 0 {
					answers[i] = 'S'
					c--
				} else if a > 0 {
					answers[i] = 'R'
					a--
				}
			}

			// あまりを割り振る
			for i := 0; i < n; i++ {
				if answers[i] == 'x' {
					if a > 0 {
						answers[i] = 'R'
						a--
					} else if b > 0 {
						answers[i] = 'P'
						b--
					} else if c > 0 {
						answers[i] = 'S'
						c--
					}
				}
			}

			fmt.Println(string(answers))
		} else {
			fmt.Println("NO")
		}
	}
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

package main

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

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

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var t int
	mp := map[byte]byte{
		'R': 0,
		'P': 1,
		'S': 2,
	}
	for Fscan(in, &t); t > 0; t-- {
		pos := make([][]int, 3)

		ans := 0

		var n, a, b, c int
		var s []byte
		Fscan(in, &n, &a, &b, &c, &s)
		for i, c := range s {
			s[i] = mp[c]
			pos[s[i]] = append(pos[s[i]], i)
		}
		min2, min0, min1 := min(a, len(pos[2])), min(b, len(pos[0])), min(c, len(pos[1]))
		ans += min0 + min1 + min2

		limit := n / 2
		if n&1 == 1 {
			limit++
		}
		if ans >= limit {
			Fprintln(out, "YES")

			for i := 0; i < min0; i++ {
				s[pos[0][i]] = 'P'
			}
			for i := 0; i < min1; i++ {
				s[pos[1][i]] = 'S'
			}
			for i := 0; i < min2; i++ {
				s[pos[2][i]] = 'R'
			}
			for i,c := range s {
				var left byte
				if a > 0 {
					left = 'R'
					a--
				} else if b > 0 {
					left = 'P'
					b--
				} else {
					left = 'S'
					c--
				}
				if c <=2 {
					s[i] = left
				}
			}
			Fprintln(out, string(s))
		} else {
			Fprintln(out, "NO")
		}
	}

}

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

package main

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

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

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var t int
	mp := map[byte]byte{
		'R': 0,
		'P': 1,
		'S': 2,
	}
	for Fscan(in, &t); t > 0; t-- {
		pos := make([][]int, 3)

		ans := 0

		var n, a, b, c int
		var s []byte
		Fscan(in, &n, &a, &b, &c, &s)
		for i, c := range s {
			s[i] = mp[c]
			pos[s[i]] = append(pos[s[i]], i)
		}
		min2, min0, min1 := min(a, len(pos[2])), min(b, len(pos[0])), min(c, len(pos[1]))
		ans += min0 + min1 + min2

		limit := n / 2
		if n&1 == 1 {
			limit++
		}
		if ans >= limit {
			Fprintln(out, "YES")

			for i := 0; i < min0; i++ {
				s[pos[0][i]] = 'P'
			}
			for i := 0; i < min1; i++ {
				s[pos[1][i]] = 'S'
			}
			for i := 0; i < min2; i++ {
				s[pos[2][i]] = 'R'
			}
			for i,c := range s {
				if c <=2 {
					var left byte
					if a > 0 {
						left = 'R'
						a--
					} else if b > 0 {
						left = 'P'
						b--
					} else {
						left = 'S'
						c--
					}
					s[i] = left
				}
			}
			Fprintln(out, string(s))
		} else {
			Fprintln(out, "NO")
		}
	}

}

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


package main

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

func solve(reader *bufio.Reader, writer *bufio.Writer) {
	n := readInt(reader)
	a := readArrayInt(reader)

	for i := 1; i < n; i++ {
		if a[i] < a[0] {
			fmt.Fprintln(writer, "Alice")
			return
		}
	}
	fmt.Fprintln(writer, "Bob")
}

func main() {
	reader := bReader(os.Stdin)
	writer := bWriter(os.Stdout)

	t := readInt(reader)

	for t > 0 {
		solve(reader, writer)
		t--
	}

	writer.Flush()
}

func min[T int | int64](a, b T) T {
	if a < b {
		return a
	}

	return b
}

func max[T int | int64](a, b T) T {
	if a > b {
		return a
	}

	return b
}

func abs[T int | int64](a T) T {
	if a < 0 {
		return a * -1
	} else {
		return a
	}
}

func gcd[T int | int64](x, y T) T {
	for y > 0 {
		x, y = y, x%y
	}

	return x
}

func lcm[T int | int64](x, y T) T {
	return x * y / gcd(x, y)
}

func bReader(stdin *os.File) *bufio.Reader {
	return bufio.NewReaderSize(stdin, 16*1024*1024)
}

func bWriter(stdout *os.File) *bufio.Writer {
	return bufio.NewWriterSize(stdout, 16*1024*1024)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

func readInt(reader *bufio.Reader) int {
	return int(readInt64(reader))
}

func readInt64(reader *bufio.Reader) int64 {
	value, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	return value
}

func readString(reader *bufio.Reader) string {
	return readLine(reader)
}

func readArrayString(reader *bufio.Reader) []string {
	return strings.Split(strings.TrimSpace(readLine(reader)), " ")
}

func readArrayInt(reader *bufio.Reader) []int {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := int(arItemTemp)
		ar = append(ar, arItem)
	}

	return ar
}

func readArrayInt64(reader *bufio.Reader) []int64 {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int64

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := arItemTemp
		ar = append(ar, arItem)
	}

	return ar
}

func readTwoInt(reader *bufio.Reader) (int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1]
}

func readTwoInt64(reader *bufio.Reader) (int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1]
}

func readThreeInt(reader *bufio.Reader) (int, int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1], ar[2]
}

func readThreeInt64(reader *bufio.Reader) (int64, int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1], ar[2]
}

package main

import . "fmt"
import "bufio"
import "os"

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func ans() {
	var n int
	Fscan(in, &n)
	var a []int = make([]int, n)
	for i := 0; i < n; i++ {
		Fscan(in, &a[i])
	}
	var min int = a[1]
	for i := 2; i < n; i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	if a[0] <= min {
		Fprintln(out, "Bob")
		return
	}
	Fprintln(out, "Alice")
}

func main() {
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans()
	}
}

package main

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

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func solve() {
	_, a := _readArr()
	x := a[0]
	a = a[1:]
	if _min(a...) < x {
		_print("Alice")
	} else {
		_print("Bob")
	}
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr(x ...int) (int, []int) {
	var n int
	if len(x) == 0 {
		fmt.Fscan(in, &n)
	} else {
		n = x[0]
	}
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] > x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _min(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] < x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _sum(x ...int) int {
	res := 0
	for _, i := range x {
		res += i
	}
	return res
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}
func _makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main

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

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func solve() {
	_, a := _readArr()
	x := a[0]
	a = a[1:]
	if _sum(a...)%2 != x%2 {
		_print("Alice")
	} else {
		_print("Bob")
	}
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr(x ...int) (int, []int) {
	var n int
	if len(x) == 0 {
		fmt.Fscan(in, &n)
	} else {
		n = x[0]
	}
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] > x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _min(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] < x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _sum(x ...int) int {
	res := 0
	for _, i := range x {
		res += i
	}
	return res
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}
func _makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main

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

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func solve() {
	_, a := _readArr()
	if _sum(a...)%2 == 0 {
		_print("Bob")
	} else {
		_print("Alice")
	}
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr(x ...int) (int, []int) {
	var n int
	if len(x) == 0 {
		fmt.Fscan(in, &n)
	} else {
		n = x[0]
	}
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] > x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _min(x ...int) int {
	mi := 0
	for i := 1; i < len(x); i++ {
		if x[i] < x[mi] {
			mi = i
		}
	}
	return x[mi]
}
func _sum(x ...int) int {
	res := 0
	for _, i := range x {
		res += i
	}
	return res
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}
func _makeMatrix(n, m int) [][]int {
	x := make([][]int, n)
	for i := range x {
		x[i] = make([]int, m)
	}
	return x
}

package main

import . "fmt"
import "bufio"
import "os"

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func ans() {
	var n int
	Fscan(in, &n)
	var a []int = make([]int, n)
	for i := 0; i < n; i++ {
		Fscan(in, &a[i])
	}
	for i := 1; i < n; i++ {
		if a[0] <= a[i] {
			Fprintln(out, "Bob")
			return
		}
	}
	Fprintln(out, "Alice")
}

func main() {
	defer out.Flush()
	var t int
	Fscan(in, &t)
	for i := 0; i < t; i++ {
		ans()
	}
}

package main

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

func solve(reader *bufio.Reader, writer *bufio.Writer) {
	n := readInt(reader)
	a := readArrayInt64(reader)

	var sum int64
	for i := 0; i < n; i++ {
		sum += a[i]
	}

	if sum%2 == 0 {
		fmt.Fprintln(writer, "Bob")
	} else {
		fmt.Fprintln(writer, "Alice")
	}

}

func main() {
	reader := bReader(os.Stdin)
	writer := bWriter(os.Stdout)

	t := readInt(reader)

	for t > 0 {
		solve(reader, writer)
		t--
	}

	writer.Flush()
}

func max(a int, b int) int {
	return int(maxInt64(int64(a), int64(b)))
}

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

	return b
}

func min(a int, b int) int {
	return int(minInt64(int64(a), int64(b)))
}

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

	return b
}

func bReader(stdin *os.File) *bufio.Reader {
	return bufio.NewReaderSize(stdin, 16*1024*1024)
}

func bWriter(stdout *os.File) *bufio.Writer {
	return bufio.NewWriterSize(stdout, 16*1024*1024)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

func readInt(reader *bufio.Reader) int {
	return int(readInt64(reader))
}

func readInt64(reader *bufio.Reader) int64 {
	value, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	return value
}

func readString(reader *bufio.Reader) string {
	return readLine(reader)
}

func readArrayString(reader *bufio.Reader) []string {
	return strings.Split(strings.TrimSpace(readLine(reader)), " ")
}

func readArrayInt(reader *bufio.Reader) []int {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := int(arItemTemp)
		ar = append(ar, arItem)
	}

	return ar
}

func readArrayInt64(reader *bufio.Reader) []int64 {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int64

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := arItemTemp
		ar = append(ar, arItem)
	}

	return ar
}

func readTwoInt(reader *bufio.Reader) (int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1]
}

func readTwoInt64(reader *bufio.Reader) (int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1]
}

func readThreeInt(reader *bufio.Reader) (int, int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1], ar[2]
}

func readThreeInt64(reader *bufio.Reader) (int64, int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1], ar[2]
}


package main

import (
	"bytes"
	"os"
	"io/ioutil"
	"fmt"
	"sort"
)

type Path struct {
	v int
	s int
	w int64
}

type Int64s []int64

func (this Int64s) Len() int { return len(this) }

func (this Int64s) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return this[i] < this[j]
}

func (this Int64s) Swap(i, j int) {
	this[i], this[j] = this[j], this[i]
}

type Paths []*Path

func (this Paths) Len() int { return len(this) }

func (this Paths) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return this[i].w < this[j].w
}

func (this Paths) Swap(i, j int) {
	this[i], this[j] = this[j], this[i]
}

var edges [200000][]*Path
var n, m, k int

var union [200000]int

func find(i int) int {
	if union[i] == i {
		return i
	} else {
		union[i] = find(union[i])
		return union[i]
	}
}

func merge(i, j int) {
	union[find(j)] = find(i)
}

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	fmt.Fscanf(reader, "%d %d %d\n", &n, &m, &k)
	for i := 0;i < n;i ++ {
		union[i] = i;
		edges[i] = []*Path{}
	}
	paths := &Paths{}
	for i := 0;i < m;i ++ {
		var x, y int
		var w int64
		fmt.Fscanf(reader, "%d %d %d\n", &x, &y, &w)
		*paths = append(*paths, &Path{x - 1, y - 1, w})
	}
	sort.Sort(paths)
	for i := 0;i < k && i < len(*paths);i ++ {
		p := (*paths)[i]
		edges[p.s] = append(edges[p.s], p)
		merge(p.s, p.v)
	}

	visited := map[int]bool{}
	m := map[int][]int{}

	res := Int64s{}
	for i := 0;i < len(*paths) && i < k;i ++ {
		p := (*paths)[i]
		u := find(p.s)
		if _, ok := m[u]; !ok {
			m[u] = make([]int, 0, 401)
		}
		if _, ok := visited[p.s]; !ok {
			m[u] = append(m[u], p.s)
			visited[p.s] = true
		}
		if _, ok := visited[p.v]; !ok {
			m[u] = append(m[u], p.v)
			visited[p.v] = true
		}
	}
	for _, vset := range m {
		//fmt.Printf("vset: %+v\n",vset)
		vmap := map[int]int{}
		d := make([][]int64, len(vset))
		for i := 0;i < len(vset);i ++ {
			vmap[vset[i]] = i
			d[i] = make([]int64, len(vset))
		}
		for i := 0;i < len(vset);i ++ {
			edgelist := edges[vset[i]]
			for j := 0;j < len(edgelist);j ++ {
				e := edgelist[j]
				d[i][vmap[e.v]] = e.w
				d[vmap[e.v]][i] = e.w
			}
		}
		for k := 0;k < len(vset);k ++ {
			for i := 0;i < len(vset);i ++ {
				for j := 0;j < len(vset);j ++ {
					if i != j && d[i][k] != 0 && d[k][j] != 0 && (d[i][j] == 0 || d[i][k] + d[k][j] < d[i][j]) {
						d[i][j] = d[i][k] + d[k][j]
					}
				}
			}
		}
		for i := 0;i < len(vset);i ++ {
			for j := i + 1;j < len(vset);j ++ {
				res = append(res, d[i][j])
			}
		}
	}
	sort.Sort(res)
	fmt.Printf("%d", res[k - 1])
}

package main

import (
	"bufio"
	"container/heap"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
type edge struct {
	v, w int
	d    int64
}
type hp []edge

func (h hp) Len() int            { return len(h) }
func (h hp) Less(i, j int) bool  { return h[i].d < h[j].d }
func (h hp) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *hp) Push(v interface{}) { *h = append(*h, v.(edge)) }
func (h *hp) Pop() interface{}   { a := *h; v := a[len(a)-1]; *h = a[:len(a)-1]; return v }
func (h *hp) push(v edge)        { heap.Push(h, v) }
func (h *hp) pop() edge          { return heap.Pop(h).(edge) }

func CF1196F(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, m, k, v, w, wt int
	Fscan(in, &n, &m, &k)
	q := hp{}
	for ; m > 0; m-- {
		Fscan(in, &v, &w, &wt)
		q = append(q, edge{v, w, int64(wt)})
	}
	heap.Init(&q)

	ans := int64(0)
	dis := make([]map[int]int64, n+1)
	for i := 1; i <= n; i++ {
		dis[i] = map[int]int64{}
	}
	for k > 0 && len(q) > 0 {
		e := q.pop()
		v, w := e.v, e.w
		if dis[v][w] > 0 {
			continue
		}
		for v, d := range dis[v] {
			q.push(edge{w, v, d + e.d})
		}
		for w, d := range dis[w] {
			q.push(edge{v, w, d + e.d})
		}
		dis[v][w] = e.d
		dis[w][v] = e.d
		ans = e.d
		k--
	}
	Fprint(out, ans)
}

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


package main

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

var (
	MOD = int64(1000000007)
	POW2 [300001]int64
)

func Init() {
	POW2[0] = 1
	for i := 1; i < len(POW2); i++ {
		POW2[i] = (POW2[i - 1] << 1) % MOD
	}
}

func Solve(io *FastIO) {
	N := io.NextInt()
	X := io.NextLongArray(N)

	sort.Sort(Int64Slice(X))

	sum := int64(0)
	for i, v := range X {
		sum += v * (POW2[i] - POW2[N - i - 1])
		sum %= MOD
	}
	io.Println(sum)
}

type Int64Slice []int64

func (a Int64Slice) Len() int {
	return len(a)
}

func (a Int64Slice) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func (a Int64Slice) Less(i, j int) bool {
	return a[i] < a[j]
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

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

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int {
	if !in.Scan() {
		panic(in.Err())
	}
	res := 0
	for _, b := range in.Bytes() {
		res = res*10 + int(b-'0')
	}
	return res
}

func main() {
	in.Split(bufio.ScanWords)

	n := readInt()
	x := make([]int, n)
	for i := range x {
		x[i] = readInt()
	}
	sort.Ints(x)

	const mod int64 = 1e9 + 7
	pow := make([]int64, n+1)
	pow[0] = 1
	for i := range pow[1:] {
		pow[i+1] = pow[i] * 2 % mod
	}
	var res int64
	for i := range x {
		xi := int64(x[i])
		res = ((res+xi*pow[i])%mod + mod - (xi*pow[n-1-i])%mod) % mod
	}
	fmt.Println(res)
}


package main

import "fmt"

const N = 1e2 + 2

var a[N][N] int64
var vis[N] int64

func main() {
  var m, n int
  fmt.Scan(&n, &m)
  for i := 1; i <= m; i++ {
    for j := 1; j <= n; j++ {
      fmt.Scan(&a[i][j])
    }
  }
  for i := 1; i <= m; i++ {
    var cur int64
    var pos int
    cur = a[i][1]
    pos = 1
    for j := 2; j <= n; j++ {
      if a[i][j] > cur {
        cur = a[i][j]
        pos = j
      }
    }
    vis[pos]++
  }
  var res int64
  var pos int
  res = 0
  for i := 1; i <= n; i++ {
    if res < vis[i] {
      res = vis[i]
      pos = i
    }
  }
  fmt.Println(pos);
}

package main

import (
    "fmt"
)

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

    counts := make([]int, n);

    for i := 0; i < m; i++ {
        most := 0
        idx := 0
        for j := 0; j < n; j++ {
            c := 0
            fmt.Scan(&c)
            if c > most {
                most = c
                idx = j
            }
        }
        counts[idx] += 1
    }

    won_counts := 0
    winner := 0
    for i := 0; i < n; i++ {
        if counts[i] > won_counts {
            won_counts = counts[i]
            winner = i
        }
    }
    fmt.Println(winner+1)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	votes := make([][]int, 100)

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

	wins := make([]int, 100)

	for i := 0; i < m; i++ {
		max := -1
		ind := 0
		for j := 0; j < n; j++ {
			if votes[i][j] > max {
				max = votes[i][j]
				ind = j
			}
		}
		wins[ind]++
	}

	ind := -1
	max := -1
	for i := 0; i < n; i++ {
		if wins[i] > max {
			ind = i
			max = wins[i]
		}
	}

	fmt.Printf("%d\n", ind+1)
}

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

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

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

type Int int64

func main() {
	defer w.Flush()
	var m, n Int
	for I(&n, &m) == nil {
		solve(m, n)
	}
}

func solve(m, n Int) {
	in := make([][]Int, m)
	o := make([]Int, n)
	for i := Int(0); i < m; i++ {
		in[i] = make([]Int, n)
		var max, jmax Int
		for j := Int(0); j < n; j++ {
			I(&in[i][j])
			if in[i][j] > max {
				max = in[i][j]
				jmax = j
			}
		}
		o[jmax]++
	}
	var ans, max Int
	for i := Int(0); i < n; i++ {
		if o[i] > max {
			max = o[i]
			ans = i
		}
	}
	O(ans+1, "\n")
}

package main

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

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

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

	n, m := nextInt(), nextInt()
	candidates := make([]int, n)

	for i := 0; i < m; i++ {
		winnerIndex := 0
		lastVote := 0

		for j := 0; j < n; j++ {
			vote := nextInt()

			if vote > lastVote {
				winnerIndex = j
				lastVote = vote
			}
		}

		candidates[winnerIndex]++
	}

	winner := 0

	for i := range candidates {
		if candidates[i] > candidates[winner] {
			winner = i
		}
	}

	println(winner + 1)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

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 "fmt"

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

    votes := make([]int, n)
    for i := 0; i < m; i++ {
        idx := 0
        max := 0
        for j := 0; j < n; j++ {
            var v int
            if j == n - 1 {
                fmt.Scanf("%d\n", &v)
            } else {
                fmt.Scanf("%d", &v)
            }
            if v > max {
                idx = j
                max = v
            }
        }
        votes[idx]++
    }

    idx := 0
    for i := 1; i < n; i++ {
        if votes[i] > votes[idx] {
            idx = i
        }
    }
    fmt.Println(idx + 1)
}

package main

import "fmt"

func main() {
	var candidates, cities int
	fmt.Scan(&candidates)
	fmt.Scan(&cities)
	results := make([]int, candidates)
	votes := make([][]int, cities)
	for i := 0; i < cities; i++ {
		votes[i] = make([]int, candidates)
	}
	for i := 0; i < cities; i++ {
		for j := 0; j < candidates; j++ {
			fmt.Scan(&votes[i][j])
		}
	}

	votemax := 0
	idmax := 0
	for i := 0; i < cities; i++ {
		for j := 0; j < candidates; j++ {
			if votes[i][j] > votemax {
				votemax = votes[i][j]
				idmax = j
			}
		}
		results[idmax]++
		idmax = 0
		votemax = 0
	}

	for i := 0; i < candidates; i++ {
		if results[i] > votemax {
			votemax = results[i]
			idmax = i
		}
	}

	fmt.Print(idmax + 1)
}

package main

import "fmt"

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

	var ticket int64
	candidates := make([]int, n)
	for i := 0; i < m; i++ {
		max := int64(0)
		win := 0
		for j := 0; j < n; j++ {
			fmt.Scan(&ticket)
			if ticket > max {
				max = ticket
				win = j
			}
		}

		candidates[win] += 1
	}

	win := 0
	for i := 1; i < n; i++ {
		if candidates[i] > candidates[win] {
			win = i
		}
	}

	fmt.Print(win + 1)
}

// Codeforces 851 B done
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
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[i])
		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,m int
var a [][]int
var winner int

func readData() {
 	in = bufio.NewReader(os.Stdin)
	// reading n
    n,m,_,_,_ = readFive()
    a = make([][]int, m)
    for i:=0; i<m; i++ {
        a[i] = make([]int, n)
        aaa := readLineNumbs(n)
        for j:=0; j<n; j++ {
            a[i][j] = aaa[j]
        }
    }
}

func findWinner(a []int, n int) int {
	winCnt := -1
	winPers := -1
	for i:=0; i<n; i++ {
		if a[i]>winCnt {
			winCnt = a[i]
			winPers = i+1
			//fmt.Printf("winCnt,winPers = %d %d\n", winCnt,winPers)
		}
	}
	//fmt.Println("winPers = ", winPers)
	return winPers
}

func solve() {
	wcnt := make([]int, n)
	for i:=0; i<m; i++ {
		wp := findWinner(a[i],n)
		wcnt[wp-1] += 1
	}
	winner = findWinner(wcnt,n)
}

func printRes() {
	fmt.Println(winner)
}

func main() {
	readData()
	solve()
	printRes()
}

package main

import (
    "fmt"
    )

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

    votes := make([]uint, n, n)
    for i := 0; i < m; i++ {
        v := 0
        vm := 0
        vmi := 0
        for j := 0; j < n; j++ {
            fmt.Scan(&v)
            if v > vm {
                vm = v
                vmi = j
            }
        }
        votes[vmi]++
    }

    result := 0
    for i := 1; i < n; i++ {
        if votes[i] > votes[result] {
            result = i
        }
    }

    fmt.Println(result + 1)
}

package main

import (
    "fmt"
)

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

    counts := make([]int, n);
    for i := 0; i < n; i++ {
        counts[i] = 0;
    }

    for i := 0; i < m; i++ {
        most := 0
        idx := 0
        for j := 0; j < n; j++ {
            c := 0
            fmt.Scan(&c)
            if c > most {
                most = c
                idx = j
            }
        }
        counts[idx] += 1
    }

    won_counts := 0
    winner := 0
    for i := 0; i < n; i++ {
        if counts[i] > won_counts {
            won_counts = counts[i]
            winner = i
        }
    }
    fmt.Println(winner+1)
}

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

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

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

type Int int64

func main() {
	defer w.Flush()
	var m, n Int
	for I(&m, &n) == nil {
		solve(m, n)
	}
}

func solve(m, n Int) {
	in := make([][]Int, m)
	o := make([]Int, n)
	for i := Int(0); i < m; i++ {
		in[i] = make([]Int, n)
		var max, jmax Int
		for j := Int(0); j < n; j++ {
			I(&in[i][j])
			if in[i][j] > max {
				max = in[i][j]
				jmax = j
			}
		}
		o[jmax]++
	}
	var ans, max Int
	for i := Int(0); i < n; i++ {
		if o[i] > max {
			max = o[i]
			ans = i
		}
	}
	O(ans+1, "\n")
}

package main

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

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

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

	n, m := nextInt(), nextInt()
	candidates := make([]int, m)

	for i := 0; i < n; i++ {
		winnerIndex := 0
		lastVote := 0

		for j := 0; j < m; j++ {
			vote := nextInt()

			if vote > lastVote {
				winnerIndex = j
				lastVote = vote
			}
		}

		candidates[winnerIndex]++
	}

	winner := 0

	for i := range candidates {
		if candidates[i] > candidates[winner] {
			winner = i
		}
	}

	println(winner + 1)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

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 "fmt"

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

    votes := make([]int, n)
    for i := 0; i < m; i++ {
        idx := 0
        max := 0
        for j := 0; j < n; j++ {
            var v int
            fmt.Scanf("%d", &v)
            if v > max {
                idx = j
                max = v
            }
        }
        votes[idx]++
    }

    idx := 0
    for i := 1; i < n; i++ {
        if votes[i] > votes[idx] {
            idx = i
        }
    }
    fmt.Println(idx + 1)
}

package main

import "fmt"

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

    votes := make([]int, n)
    for i := 0; i < m; i++ {
        idx := 0
        max := 0
        for j := 0; j < n; j++ {
            var v int
            fmt.Scanf("%d", &v)
            if v > max {
                idx = j
                max = v
            }
        }
        votes[idx]++
    }

    idx := 0
    for i := 1; i < n; i++ {
        if votes[i] > votes[idx] {
            idx = i
        }
    }
    fmt.Println(idx + 1)
}

package main

import "fmt"

func main() {
	var candidates, cities int
	fmt.Scan(&candidates);
	fmt.Scan(&cities)
	results := make([]int, candidates);
	votes := make([][]int, cities);
	for i := 0; i < cities; i++ {
		votes[i] = make([]int, cities);
	}
	for i := 0; i < cities; i++ {
		for j := 0; j < candidates; j++ {
			fmt.Scan(&votes[i][j])
		}
	}

	votemax := 0;
	idmax := 0;
	for i := 1; i < cities; i++ {
		for j := 0; j < candidates; j++ {
			if votes[i][j] > votemax {
				votemax = votes[i][j]
				idmax = j
			}
		}
		results[idmax]++;
		idmax = 0;
		votemax = 0;
	}

	for i := 0; i < candidates; i++ {
		if results[i] > votemax {
			votemax = results[i];
			idmax = i;
		}
	}

	fmt.Print(idmax + 1);
}

package main

import (
    "fmt"
)

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

    counts := make([]int, n);
    for i := 0; i < m; i++ {
        most := int64(0)
        idx := 0
        for j := 0; j < n; j++ {
            var c int64
            fmt.Scanf("%d", &c)
            if c > most {
                most = c
                idx = j
            }
        }
        counts[idx] += 1
    }

    won_counts := 0
    winner := 0
    for i := 0; i < n; i++ {
        if counts[i] > won_counts {
            won_counts = counts[i]
            winner = i
        }
    }
    fmt.Println(winner+1)
}

package main

import (
    "fmt"
)

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

    counts := make([]int, n);
    for i := 0; i < n; i++ {
        counts[i] = 0;
    }

    for i := 0; i < m; i++ {
        most := int64(0)
        idx := 0
        for j := 0; j < n; j++ {
            var c int64
            fmt.Scanf("%d", &c)
            if c > most {
                most = c
                idx = j
            }
        }
        counts[idx] += 1
    }

    won_counts := 0
    winner := 0
    for i := 0; i < n; i++ {
        if counts[i] > won_counts {
            won_counts = counts[i]
            winner = i
        }
    }
    fmt.Println(winner+1)
}

package main

import (
    "fmt"
)

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

    counts := make([]int, n);
    for i := 0; i < n; i++ {
        counts[i] = 0;
    }

    for i := 0; i < m; i++ {
        most := int64(0)
        idx := 0
        for j := 0; j < n; j++ {
            var c int64
            fmt.Scanf("%d", &c)
            if c > most {
                most = c
                idx = j
            }
        }
        counts[idx] += 1
    }

    won_counts := 0
    winner := 0
    for i := 0; i < n; i++ {
        if counts[i] > won_counts {
            won_counts = counts[i]
            winner = i
        }
    }
    fmt.Println(winner+2)
}

package main

import (
    "fmt"
)

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

    counts := make([]int, n);
    for i := 0; i < n; i++ {
        counts[i] = 0;
    }

    for i := 0; i < m; i++ {
        most := 0
        idx := 0
        for j := 0; j < n; j++ {
            c := 0
            fmt.Scanf("%d", &c)
            if c > most {
                most = c
                idx = j
            }
        }
        counts[idx] += 1
    }

    won_counts := 0
    winner := 0
    for i := 0; i < n; i++ {
        if counts[i] > won_counts {
            won_counts = counts[i]
            winner = i
        }
    }
    fmt.Println(winner+1)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	votes := make([][]int, 100)

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

	wins := make([]int, 100)
	for i := 0; i < n; i++ {
		wins[i] = 0
	}

	for i := 0; i < n; i++ {
		max := -1
		ind := 0
		for j := 0; j < n; j++ {
			if votes[i][j] > max {
				max = votes[i][j]
				ind = j
			}
		}
		wins[ind]++
	}

	ind := -1
	max := -1
	for i := 0; i < n; i++ {
		if wins[i] > max {
			ind = i
			max = wins[i]
		}
	}

	fmt.Printf("%d\n", ind+1)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	votes := make([][]int, 100)

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

	wins := make([]int, 100)
	for i := 0; i < n; i++ {
		max := -1
		ind := 0
		for j := 0; j < n; j++ {
			if votes[i][j] > max {
				max = votes[i][j]
				ind = j
			}
		}
		wins[ind]++
	}

	ind := -1
	max := -1
	for i := 0; i < n; i++ {
		if wins[i] > max {
			ind = i
			max = wins[i]
		}
	}

	fmt.Printf("%d\n", ind+1)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	votes := make([][]int, 100)

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

	wins := make([]int, 100)
	for i := 0; i < n; i++ {
		max := -1
		ind := 0
		for j := 0; j < n; j++ {
			if votes[i][j] > max {
				max = votes[i][j]
				ind = j
			}
		}
		wins[ind]++
	}

	ind := -1
	max := -1
	for i := 0; i < n; i++ {
		if wins[i] > max {
			ind = i
			max = wins[i]
		}
	}

	fmt.Printf("%d", ind+1)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	votes := make([][]int, 100)

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

	wins := make([]int, 100)
	for i := 0; i < n; i++ {
		wins[i] = 0
	}

	for i := 0; i < n; i++ {
		max := -1
		ind := 0
		for j := 0; j < n; j++ {
			if votes[i][j] > max {
				max = votes[i][j]
				ind = j
			}
		}
		wins[ind]++
	}

	ind := -1
	max := -1
	for i := 0; i < n; i++ {
		if wins[i] > max {
			ind = i
			max = wins[i]
		}
	}

	fmt.Printf("%d\n", ind+1)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	votes := make([][]int, 100)

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

	wins := make([]int, 100)
	for i := 0; i < n; i++ {
		wins[i] = 0
	}

	for i := 0; i < n; i++ {
		max := -1
		ind := 0
		for j := 0; j < n; j++ {
			if votes[i][j] > max {
				max = votes[i][j]
				ind = j
			}
		}
		wins[ind]++
	}

	ind := -1
	max := -1
	for i := 0; i < n; i++ {
		if wins[i] > max {
			ind = i
			max = wins[i]
		}
	}

	fmt.Printf("%d\n", ind+1)
}


package main

import (
	"fmt"
	"strings"
)

func replace(str string) string {
	str = strings.ToLower(str)

	str = strings.ReplaceAll(str, "0", "o")
	str = strings.ReplaceAll(str, "1", "l")
	str = strings.ReplaceAll(str, "i", "l")
	return str
}

func main() {
	// fmt.Println("hello")
	var checkLogin string;
	var regCount int;

	fmt.Scan(&checkLogin);
	checkLogin = replace(checkLogin)
	fmt.Scan(&regCount);

	registered := make([]string, regCount)
	for i := 0; i < regCount; i++ {
		fmt.Scan(&registered[i])
		registered[i] = replace(registered[i])
	}

	for _, v := range registered {
		if checkLogin == v {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var user string
	var n int
	fmt.Scan(&user)
	fmt.Scan(&n)

	user = strings.ToLower(user)
	user = strings.Replace(user, "0", "o", -1)
	user = strings.Replace(user, "l", "1", -1)
	user = strings.Replace(user, "i", "1", -1)
	answer := "Yes"
	for i := 0; i < n; i++ {
		if answer == "No" {
			continue
		}
		var temp string
		fmt.Scan(&temp)
		if len(user) != len(temp) {
			continue
		}
		temp = strings.ToLower(temp)
		temp = strings.Replace(temp, "0", "o", -1)
		temp = strings.Replace(temp, "l", "1", -1)
		temp = strings.Replace(temp, "i", "1", -1)
		if user == temp {
			answer = "No"
		}
	}
	fmt.Println(answer)

}