{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc = multiH ms ns (replicate (m*2) (n+1):acc)

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            [1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2]
        | w2 >  2 =
            let
                findli _ n3 2   []        z1 z2  _     acc = (reverse acc)++multi2 n3 2 [z1,z2] []
                findli _ n3 w3  []        z1 z2  _     acc
                    | z1  >  0 = findli  0    n3 (w3-1)   []      (z1-1) z2    [] (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      []       0     z2    []  acc
                    | z2  >  0 = findli  1    n3 (w3-1)   []       z1   (z2-1) [] (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      []       z1    0     []  acc
                findli _ n3 2   nnls      z1 z2 (i:is) acc = (reverse acc)++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3  nnls      z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3  nnls      z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j   == n3 = (reverse acc)++multi2 n3 2 (z1:z2:nnl:nnls) (i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.List
import Data.Char (isSpace)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc = multiH ms ns (replicate (m*2) (n+1):acc)

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            [1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2]
        | w2 >  2 =
            let
                findli _ n3 2   []        z1 z2  _     acc = (reverse acc)++multi2 n3 2 [z1,z2] []
                findli _ n3 w3  []        z1 z2  _     acc
                    | z1  >  0 = findli  0    n3 (w3-1)   []          (z1-1) z2    [] (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      []           0     z2    []  acc
                    | z2  >  0 = findli  1    n3 (w3-1)   []           z1   (z2-1) [] (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      []           z1    0     []  acc
                findli _ n3 2   nnls      z1 z2 (i:is) acc = (reverse acc)++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3  nnls      z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3  nnls      z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j   == n3 = (reverse acc)++multi2 n3 2 (z1:z2:nnl:nnls) (i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-          Irene Vlassi-Pandi (03108137)     -}
{-              ex1-plII-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

{- υλοποίηση αλγορίθμου από:
 - http://codeforces.com/blog/entry/610       -}

import Data.List
import Data.Char (isSpace)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc = multiH ms ns (replicate (2*m) (n+1):acc)

multi :: Int -> Int -> [Int] -> [Int]
multi n w ls
    | 1 > w || w > sum ls = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++multiH (delete 1 ls) (delete j inds) []++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            [1]++multiH [nl2] [1] []++multiH nls inds []++[1]++[2]++multiH [nl1] [0] []++[2]
        | w2 >  2 =
            let
                findli _ n3 2   []        z1 z2  _     acc = reverse acc++multi2 n3 2 [z1,z2] []
                findli _ n3 w3  []        z1 z2  _     acc
                    | z1  >  0 = findli  0    n3 (w3-1)   []          (z1-1) z2    [] (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      []           0     z2    []  acc
                    | z2  >  0 = findli  1    n3 (w3-1)   []           z1   (z2-1) [] (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      []           z1    0     []  acc
                findli _ n3 2   nnls      z1 z2 (i:is) acc = reverse acc++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3  nnls      z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3  nnls      z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j   == n3 = reverse acc++multi2 n3 2 (z1:z2:nnl:nnls) (i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-          Irene Vlassi-Pandi (03108137)     -}
{-              ex1-plII-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

{- υλοποίηση αλγορίθμου από:
 - http://codeforces.com/blog/entry/610       -}

import Data.List
import Data.Char (isSpace)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc = multiH ms ns (replicate (2*m) (n+1):acc)

multi :: Int -> Int -> [Int] -> [Int]
multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            [1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2]
        | w2 >  2 =
            let
                findli _ n3 2   []        z1 z2  _     acc = (reverse acc)++multi2 n3 2 [z1,z2] []
                findli _ n3 w3  []        z1 z2  _     acc
                    | z1  >  0 = findli  0    n3 (w3-1)   []          (z1-1) z2    [] (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      []           0     z2    []  acc
                    | z2  >  0 = findli  1    n3 (w3-1)   []           z1   (z2-1) [] (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      []           z1    0     []  acc
                findli _ n3 2   nnls      z1 z2 (i:is) acc = (reverse acc)++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3  nnls      z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3  nnls      z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j   == n3 = (reverse acc)++multi2 n3 2 (z1:z2:nnl:nnls) (i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Irene Vlassi-Pandi (03108137)       -}
{-              ex1-plII-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

{- algorithm by:                              -}
{- http://codeforces.com/blog/entry/610       -}

import Data.List
import Data.Char (isSpace)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc = multiH ms ns (replicate (2*m) (n+1):acc)

multi :: Int -> Int -> [Int] -> [Int]
multi n w ls
    | 1 > w || w > sum ls = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   (j+1):multiH (delete 1 ls) (delete j inds) []++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            1:multiH [nl2] [1] []++multiH nls inds []++[1]++[2]++multiH [nl1] [0] []++[2]
        | w2 >  2 =
            let
                findli _ n3 2   []        z1 z2  _     acc = reverse acc++multi2 n3 2 [z1,z2] []
                findli _ n3 w3  []        z1 z2  _     acc
                    | z1  >  0 = findli  0    n3 (w3-1)   []          (z1-1) z2    [] (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      []           0     z2    []  acc
                    | z2  >  0 = findli  1    n3 (w3-1)   []           z1   (z2-1) [] (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      []           z1    0     []  acc
                findli _ n3 2   nnls      z1 z2 (i:is) acc = reverse acc++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3  nnls      z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3  nnls      z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j   == n3 = reverse acc++multi2 n3 2 (z1:z2:nnl:nnls) (i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            [1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2]
        | w2 >  2 =
            let
                findli _ n3 2   []        z1 z2  _     acc = (reverse acc)++multi2 n3 2 [z1,z2] []
                findli _ n3 w3  []        z1 z2  _     acc
                    | z1  >  0 = findli  0    n3 (w3-1)   []      (z1-1) z2    [] (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      []       0     z2    []  acc
                    | z2  >  0 = findli  1    n3 (w3-1)   []       z1   (z2-1) [] (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      []       z1    0     []  acc
                findli _ n3 2   nnls      z1 z2 (i:is) acc = (reverse acc)++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3  nnls      z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3  nnls      z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j   == n3 = (reverse acc)++multi2 n3 2 (z1:z2:nnl:nnls) (i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate w 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli j n3 w3 (nnl:nnls) z1 z2 acc
                --    | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    | j == n3 || w3  == 2 = (reverse acc)++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                    | z1  >  0 && w3 > 2 && j == 0  = findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2 (1:1:acc)
                    | z1  == 0 && w3 > 2 && j == 0  = findli  1    n3  w3      nnls        0    z2      acc
                    | z2  >  0 && w3 > 2 && j == 1  = findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (2:2:acc)
                    | z2  == 0 && w3 > 2 && j == 1  = findli  2    n3  w3    nnls        z1   0          acc
                    | nnl >  0 && w3 > 2 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2  ((j+1):(j+1):acc)
                    | nnl == 0 && w3 > 2 = findli (j+1) n3  w3      nnls        z1   z2    acc
            in
                findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate w 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli j n3 w3 (nnl:nnls) z1 z2 acc
                --    | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    | j == n3 || w3  == 2 = (reverse acc)++[42]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                    | z1  >  0 && w3 > 2 && j == 0  = findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2 (1:1:acc)
                    | z1  == 0 && w3 > 2 && j == 0  = findli  1    n3  w3      nnls        0    z2      acc
                    | z2  >  0 && w3 > 2 && j == 1  = findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (2:2:acc)
                    | z2  == 0 && w3 > 2 && j == 1  = findli  2    n3  w3    nnls        z1   0          acc
                    | nnl >  0 && w3 > 2 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2  ((j+1):(j+1):acc)
                    | nnl == 0 && w3 > 2 = findli (j+1) n3  w3      nnls        z1   z2    acc
            in
                findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli _ n3 _   []        z1 z2  _     _   = multi2 n3 2 [z1,z2] [0,1]
                findli _ n3 2   nnls      z1 z2 (i:is) acc = (reverse acc)++multi2 n3 2 (z1:z2:nnls) (i:is)
                findli 0 n3 w3 nnls z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3 nnls z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j == n3 = (reverse acc)++multi2 n3 2 (z1:z2:nnl:nnls) (0:1:i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc
    -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli j n3 w3 (nnl:nnls) z1 z2 acc
                --    | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    | j == n3 || w3  == 2 = (reverse acc)++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                    | z1  >  0 && w3 > 2 && j == 0  = findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2 (1:1:acc)
                    | z1  == 0 && w3 > 2 && j == 0  = findli  1    n3  w3      nnls        0    z2      acc
                    | z2  >  0 && w3 > 2 && j == 1  = findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (2:2:acc)
                    | z2  == 0 && w3 > 2 && j == 1  = findli  2    n3  w3    nnls        z1   0          acc
                    | nnl >  0 && w3 > 2 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2  ((j+1):(j+1):acc)
                    | nnl == 0 && w3 > 2 = findli (j+1) n3  w3      nnls        z1   z2    acc
            in
                findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                --    | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    | j == n3 || w3  == 2 = (reverse acc)++multi2 n3 2 (z1:z2:(nnl:nnls)) (i:is)
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                    | z1  >  0 && w3 > 2 && j == 0  = findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 && w3 > 2 && j == 0  = findli  1    n3  w3      nnls          0     z2     is      acc
                    | z2  >  0 && w3 > 2 && j == 1  = findli  1    n3 (w3-1) ((nnl-1):nnls)  z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 && w3 > 2 && j == 1  = findli  2    n3  w3      nnls          z1    0      is      acc
                    | nnl >  0 && w3 > 2            = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 && w3 > 2            = findli (j+1) n3  w3      nnls          z1    z2     is      acc
            in
                findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate (2*w) 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli _ n3 _   []        z1 z2  _     _   = multi2 n3 2 [z1,z2] [0,1]
                findli j n3 2   nnls      z1 z2 (i:is) acc = (reverse acc)++multi2 n3 2 (z1:z2:nnls) (0:1:i:is)
                findli 0 n3 w3 nnls z1 z2 (i:is) acc
                    | z1  >  0 = findli  0    n3 (w3-1)   nnls         (z1-1) z2    (i:is)  (1:1:acc)
                    | z1  == 0 = findli  1    n3  w3      nnls          0     z2    (i:is)   acc
                findli 1 n3 w3 nnls z1 z2 (i:is) acc
                    | z2  >  0 = findli  1    n3 (w3-1)   nnls          z1   (z2-1) (i:is)  (2:2:acc)
                    | z2  == 0 = findli  2    n3  w3      nnls          z1    0     (i:is)   acc
                findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                    | j == n3 = (reverse acc)++multi2 n3 2 (z1:z2:nnl:nnls) (0:1:i:is)
                    | nnl >  0 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1    z2    (i:is) ((i+1):(i+1):acc)
                    | nnl == 0 = findli (j+1) n3  w3      nnls          z1    z2     is      acc
    -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)

            in
                findli 0 n2 w2 nls nl1 nl2 [2..(n2-1)] []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

--prosoxh ta arnhtika opws ta diavazw na vazo parentheseis
multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate w 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++(multiH (delete 1 ls) (delete (j+1) inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli j n3 w3 (nnl:nnls) z1 z2 acc
                    -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                    | j == n3 || w3  == 2 = (reverse acc)++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                    | z1  >  0 && w3 > 2 && j == 0  = findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2 (1:1:acc)
                    | z1  == 0 && w3 > 2 && j == 0  = findli  1    n3  w3      nnls        0    z2      acc
                    | z2  >  0 && w3 > 2 && j == 1  = findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (2:2:acc)
                    | z2  == 0 && w3 > 2 && j == 1  = findli  2    n3  w3    nnls        z1   0          acc
                    | nnl >  0 && w3 > 2 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2  ((j+1):(j+1):acc)
                    | nnl == 0 && w3 > 2 = findli (j+1) n3  w3      nnls        z1   z2    acc
            in
                findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls

{-        Vlassi-Pandi Irini (03108137)       -}
{-               ex1-pl2-2012                 -}
{- http://codeforces.com/contest/26/problem/E -}

import Data.Char (isSpace)
import Data.List
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

multiH :: [Int] -> [Int] -> [[Int]] -> [Int]
multiH  [ ]     _     acc = reverse (concat acc)
multiH   _     [ ]    acc = reverse (concat acc)
multiH (m:ms) (n:ns)  acc
    | m/= 0 = multiH ms ns (replicate (m*2) (n+1):acc)
    | otherwise = []

multi :: Int -> Int -> [Int] -> [Int]

--prosoxh ta arnhtika opws ta diavazw na vazo parentheseis
multi n w ls
    | 1 > w || w > (sum ls) = []

multi 1 w [l]
    | l == w =
        replicate w 1
    | otherwise = []

multi n 1 ls
    | n >= 2 =
        let
            js   = findIndices (==1)    ls
            inds = findIndices (/=(-1)) ls
        in
           if (js /= [])
           then
               let
                   j = head js
               in
                   [j+1]++[42]++(multiH (delete 1 ls) (delete j inds) [])++[j+1]
           else []

multi n w (l1:l2:ls) =
    let
       multi2 n2 w2 (nl1:nl2:nls) inds
        | w2 == 2 =
            ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
        | w2 >  2 =
            let
                findli j n3 w3 (nnl:nnls) z1 z2 acc
                --    | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++[w3]++[j]
                    | j == n3 || w3  == 2 = (reverse acc)++[42]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                    -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                    | z1  >  0 && w3 > 2 && j == 0  = findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2 (1:1:acc)
                    | z1  == 0 && w3 > 2 && j == 0  = findli  1    n3  w3      nnls        0    z2      acc
                    | z2  >  0 && w3 > 2 && j == 1  = findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (2:2:acc)
                    | z2  == 0 && w3 > 2 && j == 1  = findli  2    n3  w3    nnls        z1   0          acc
                    | nnl >  0 && w3 > 2 = findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2  ((j+1):(j+1):acc)
                    | nnl == 0 && w3 > 2 = findli (j+1) n3  w3      nnls        z1   z2    acc
            in
                findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 []
    in
       multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]

{-
multi n w (l1:l2:ls)
    | n >= 2 =
            let
                multi2 n2 w2 (nl1:nl2:nls) inds
                    | w2 == 2 =
                        ([1]++(multiH [nl2] [1] [])++(multiH nls inds [])++[1]++[2]++(multiH [nl1] [0] [])++[2])
                    | w2 >  2 =
                        let
                            findli j n3 w3 (nnl:nnls) z1 z2 (i:is) acc
                                -- | otherwise = (reverse acc)++[z1]++[z2]++[nnl]++nnls++(i:is)++[w3]++[j]
                                | j == n3 || w3  == 2 = [42]++(reverse acc)++[32]++multi2 n3 2 (z1:z2:(nnl:nnls)) [2..(n3-1)]
                                -- | n == 1 || w == 2 = (reverse acc)++multi2 (n+1) w  (l:ls)   (i:is)
                                | z1  >  0 && w3 > 2 && j == 0  =[j]++ findli  0    n3 (w3-1) ((nnl-1):nnls) (z1-1) z2   (i:is) (1:1:acc)
                                | z1  == 0 && w3 > 2 && j == 0  = [j]++findli  1    n3  w3      nnls        0    z2    is     acc
                                | z2  >  0 && w3 > 2 && j == 1  = [j]++findli  1    n3 (w3-1) ((nnl-1):nnls)  z1  (z2-1) (i:is) (2:2:acc)
                                | z2  == 0 && w3 > 2 && j == 1  = [j]++findli  2    n3  w3    nnls        z1   0     is     acc
                                | nnl >  0 && w3 > 2 && j /=0 && j /=1  =[j]++ findli  j    n3 (w3-1) ((nnl-1):nnls)  z1   z2   (i:is) ((i+1):(i+1):acc)
                                | nnl == 0 && w3 > 2 && j /=0 && j/=1  = [j]++findli (j+1) n3  w3      nnls        z1   z2    is     acc
                        in
                            findli 0 n2 w2 (nl1:nl2:nls) nl1 nl2 [0..(n2-1)] []
             in
                multi2 n w ((l1-1):(l2-1):ls) [2..(n-1)]
     | otherwise = []

-}

main =
  do all <- BS.getContents
     let Just (n, r1) = readInt all
     let Just (w, r2) = readInt r1
     let (x, _)  = readMany readInt r2
     let answer = (multi n w x)
     print_yesno answer
     printList answer
  where readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
          Just (x, r) -> let (xs, t) = readMany readf r
                         in  (x : xs, t)
          Nothing     -> ([], s)
        print_yesno [] = putStrLn "No"
        print_yesno _  = putStrLn "Yes"
        printList []     = putStrLn""
        printList (l:[]) =
          do
              putStrLn (show l)
        printList (l:ls) =
          do
              putStr (show l++ " ")
              printList ls


module Main where

import Control.Monad
import Data.List

getStrList :: IO [String]
getStrList = words <$> getLine

getIntList :: IO [Int]
getIntList = map read <$> getStrList

main :: IO ()
main = do
    n <- readLn
    putStrLn $ (show (n * 9) ++ " " ++ show (n * 8))

convert :: Read a => String -> [a]
convert = map read . words

main :: IO ()
main = do
  line <- getLine
  let [n] = convert line :: [Int]
  if n == 1
  then putStrLn "9 8"
  else putStrLn $ (show $ 3 * n) ++ " " ++ (show $ 2 * n)

import Control.Applicative
import Control.Monad
import Data.List
import Data.Maybe
import Data.Array

process n | even n = do
			putStrLn $ intercalate " " $ map show [n+4,4]
	  | mod n 10 == 5 = do
			putStrLn $ intercalate " " $ map show [n+10,10]
	  | mod n 10 == 9 = do
			putStrLn $ intercalate " " $ map show [n+21,21]
	  | mod n 10 == 7 = do
			putStrLn $ intercalate " " $ map show [n+33,33]
	  | mod n 10 == 3 = do
			putStrLn $ intercalate " " $ map show [n+27,27]
	  | otherwise = do
			putStrLn $ intercalate " " $ map show [n+9,9]

main = do
	n<- read <$> getLine ::IO Int
	process n

process :: Int -> (Int, Int)
process 1 = (9,8)
process n = (3*n,2*n)

readInt :: String -> Int
readInt = read

main :: IO ()
main = do
    n <- fmap readInt getLine
    let  (a,b) = process n
    putStrLn (show a ++ " " ++ show b)

{- This code was written by
Russell Emerine - linguist,
mathematician, coder,
musician, and metalhead. -}

main = getLine >>= putStrLn.unwords.map show.(\n -> [9 * n, 8 * n]).read

module Main where

import Control.Monad
import Data.List

getStrList :: IO [String]
getStrList = words <$> getLine

getIntList :: IO [Int]
getIntList = map read <$> getStrList

main :: IO ()
main = do
    n <- readLn
    putStrLn $ (show (n * 3) ++ " " ++ show (n * 2))


import Data.List
import Data.Maybe
import qualified Data.Map as Map

readInteger :: String -> Integer
readInteger = read

parseInput :: String -> [Integer]
parseInput file
    = [ readInteger word | word <- words $ last $ lines file ]

showOutput :: [Int] -> String
showOutput xs = (show $ length xs) ++ "\n" ++ showIndices xs
    where
        showIndices :: [Int] -> String
        showIndices [] = ""
        showIndices [x] = show x ++ "\n"
        showIndices (x:xs) = show x ++ " " ++ showIndices xs

process :: [Integer] -> [Int]
process xs =
    let table = getTable xs
        lookupTable x = fromMaybe 0 (Map.lookup x table)
        total = sum xs
        isGood x
            | odd y = False
            | otherwise = lookupTable z > (if x == z then 1 else 0)
            where y = total - x
                  z = y `div` 2
    in map (1+) $ findIndices (\x -> isGood x) xs

getTable :: [Integer] -> Map.Map Integer Int
getTable xs = Map.fromList $ map (\ys -> (head ys, length ys)) (group $ sort xs)

main :: IO ()
main = do
    n <- getLine
    line <- getLine
    (putStr . showOutput . process . parseInput) line

main = do
    l0 <- getLine
    l1 <- getLine
    let j = calc $ readArray l1
    putStrLn $ show $ length j
    putStrLn $ join " " $ map show j

join d [] = ""
join d (x:[]) = x
join d (x:xs) = x ++ d ++ join d xs

splitByChar d "" = []
splitByChar d x = let (y, ys) = splitOneByChar d x in y:splitByChar d ys

splitOneByChar d [] = ("", "")
splitOneByChar d (x:xs)
    | x == d = ("", xs)
    | otherwise = let (y, ys) = splitOneByChar d xs in (x:y, ys)

readArray x = map read $ splitByChar ' ' x

getTwoLargest x =
    let p [] l0 l1 = (l0, l1)
        p (y:ys) l0 l1
            | y > l0 = p ys y l0
            | y > l1 = p ys l0 y
            | otherwise = p ys l0 l1
    in  p x 0 0

calc x =
    let s = sum x
        (lar0, lar1) = getTwoLargest x
        p [] _ js = js
        p (y:ys) j js
            | s - y == (if lar0 == y then lar1 else lar0) * 2 = p ys (j + 1) (j:js)
            | otherwise = p ys (j + 1) js
    in  p x 1 []

import Data.List
import Data.Maybe
import qualified Data.Map as Map

readInteger :: String -> Integer
readInteger = read

parseInput :: String -> [Integer]
parseInput file
    = [ readInteger word | word <- words $ last $ lines file ]

showOutput :: [Int] -> String
showOutput xs = (show $ length xs) ++ "\n" ++ showIndices xs
    where
        showIndices :: [Int] -> String
        showIndices [] = ""
        showIndices [x] = show x ++ "\n"
        showIndices (x:xs) = show x ++ " " ++ showIndices xs

main :: IO ()
main = do interact $ showOutput . process . parseInput

process :: [Integer] -> [Int]
process xs =
    let getNum x = fromMaybe 0 (Map.lookup x table) where table = getTable xs
        total = sum xs
        isGood x | odd remain = False
                 | otherwise = isAvailable (remain `div` 2)
                   where remain = total - x
                         isAvailable y = getNum y > (if x == y then 1 else 0)
    in map succ $ findIndices (\x -> isGood x) xs

getTable :: [Integer] -> Map.Map Integer Int
getTable xs = Map.fromAscList $ map (\ys -> (head ys, length ys)) (group $ sort xs)

import Data.List
import Data.Maybe
import qualified Data.Map as Map

readInteger :: String -> Integer
readInteger = read

parseInput :: String -> [Integer]
parseInput file
    = [ readInteger word | word <- words $ last $ lines file ]

showOutput :: [Int] -> String
showOutput xs = (show $ length xs) ++ "\n" ++ showIndices xs
    where
        showIndices :: [Int] -> String
        showIndices [] = ""
        showIndices [x] = show x ++ "\n"
        showIndices (x:xs) = show x ++ " " ++ showIndices xs

process :: [Integer] -> [Int]
process xs
    = let table = map (\ys -> (head ys, genericLength ys)) (group $ sort xs)
          total = sum xs
          lookupTable x = fromMaybe 0 (lookup x table)
          low x y = if x == y then 1 else 0
          isGood x
            | odd y = False
            | otherwise = lookupTable x > low x z
            where y = total - x; z = y `div` 2
      in map (1+) $ findIndices (\x -> isGood x) xs

main :: IO ()
main = do interact $ showOutput . process . parseInput


import Control.Monad
import Data.Array
import Data.Maybe
import qualified Data.ByteString.Char8 as C

gao n e = concatMap (\i -> zip i $ drop 1 i) $ elems $ accumArray (flip (:)) [] (1,n) $
  concat $ zipWith (\k [i, j] -> [(i, k), (j, k)]) [1 ..] e

get = fmap (map (fst . fromJust . C.readInt) . C.words) C.getLine

put = putStr . unlines . map (unwords . map show)

main = do
  [n] <- get
  e <- replicateM (n - 1) $ get
  put $ [[n - 1]]
  put $ map (2:) e
  put $ map (\(i, j) -> [i, j]) $ gao n e

import Control.Monad
import Data.Array
import Data.Maybe
import Prelude hiding (getLine, words)
import Data.ByteString.Char8 (getLine, words, readInt)
-- import Data.ByteString.Lazy.Char8 (unwords, unlines, putStr)

gao n e = concatMap (\i -> zip i $ drop 1 i) $ elems $ accumArray (flip (:)) [] (1,n) $
  concat $ zipWith (\k [i, j] -> [(i, k), (j, k)]) [1 ..] e

get = fmap (map (fst . fromJust . readInt) . words) getLine

put = putStr . unlines . map (unwords . map show)

main = do
  [n] <- get
  e <- replicateM (n - 1) $ get
  put $ [[n - 1]]
  put $ map (2:) e
  put $ map (\(i, j) -> [i, j]) $ gao n e


module Main where
import Data.List
import Data.List.Split

main = do
  getLine -- for length, which we don't need
  input <- getLine
  let
    list = (read :: String -> Int) `map` splitOn " " input
    result2List = init . tail $ expand (head origList) result2Lens
    origList = head list : list ++ [last list]
    groupLen = group $ length `map` group origList
    lenLens = length `map` filter ((==1) . head) groupLen
    result2Lens = concat . map modOne $ groupLen
    modOne xs@(1:_) =
      if length xs `mod` 2 == 0 then
        [0, length xs `div` 2, length xs `div` 2, 0]
      else
        [0, length xs, 0]
    modOne xs = xs
    expand h xs = concat $ zipWith replicate xs (cycle [h, 1-h])
  print $ (maximum (0:lenLens) + 1) `div` 2
  putStrLn $ " " `intercalate` (show `map` result2List)

{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main where

import Control.Applicative
import Data.Foldable (foldMap)
import Data.List
import Data.Monoid

newtype Nat = Nat Int deriving (Eq, Ord, Num)

instance Monoid Nat where
  mempty  = 0
  mappend = max

data Segment = Segment Int Bool deriving Show

type Solution = (Nat, [Bool])

segments :: [Bool] -> [Segment]
segments = foldr f []
  where
    f x (s@(Segment n y):ss)
      | odd n == (x /= y) = Segment (n + 1) y : ss
    f x ss = Segment 1 x : ss

solveSegment :: Segment -> Solution
solveSegment (Segment n x)
  | even n    = (Nat (k - 1), replicate k (not x) ++ replicate k x)
  | otherwise = (Nat k,       replicate n x)
  where
    k = n `div` 2

solve :: [Bool] -> Solution
solve = foldMap solveSegment . segments

main :: IO ()
main = do
  _ <- getLine
  xs <- map (toEnum . read) . words <$> getLine
  let (Nat n, ys) = solve xs
  print n
  putStrLn (showSeq ys)

  where
    showSeq = intercalate " " . map (show . fromEnum)

module Main where
import Data.List
import Debug.Trace

split :: String -> [String]
split str = result where
  result
    | remain == "" = reslist
    | otherwise = remain:reslist
  (remain, reslist) = foldr process ("", []) str
  process ' ' ("", a) = ("", a)
  process ' ' (str, a) = ("", str:a)
  process c (str, a) = (c:str, a)

summerize :: [Int] -> (Int, Int)
summerize xs = (head xs, length xs)

dupHeadTail :: [Int] -> [Int]
dupHeadTail xs@(x:_) = x:dupTail xs where
  dupTail (x:[]) = [x, x]
  dupTail (x:xs) = x:dupTail xs

remHeadTail :: [Int] -> [Int]
remHeadTail xss@(x:xs) = remTail xs where
  remTail (x:[]) = []
  remTail (x:xs) = x:remTail xs

main = do
  getLine -- for length, which we don't need
  input <- getLine
  let
    result1 = (maxOne + 1) `div` 2
    result2List = remHeadTail $ expand header result2Lens
    origList = dupHeadTail $ (read :: String -> Int) `map` split input
    header = head origList
    lenList = length `map` group origList
    groupLen = group lenList
    lenLens = length `map` filter ((==1) . head) groupLen
    maxOne
      | lenLens == [] = 0
      | otherwise = maximum lenLens
    result2Lens = concat . map modOne $ groupLen
    modOne xs@(1:_) =
      if length xs `mod` 2 == 0 then
        [0, length xs `div` 2, length xs `div` 2, 0]
      else
        [0, length xs, 0]
    modOne xs = xs
    expand h xs = concat $ zipWith replicate xs (cycle [h, 1-h])
  print result1
  putStrLn $ " " `intercalate` (show `map` result2List)

module Main where
import Data.List
import Data.List.Split

main = do
  getLine -- for length, which we don't need
  input <- getLine
  let
    list = (read :: String -> Int) `map` splitOn " " input
    result2List = init . tail $ expand (head origList) result2Lens
    origList = [head list] ++ list ++ [last list]
    groupLen = group $ length `map` group origList
    lenLens = length `map` filter ((==1) . head) groupLen
    result2Lens = concat . map modOne $ groupLen
    modOne xs@(1:_) =
      if length xs `mod` 2 == 0 then
        [0, length xs `div` 2, length xs `div` 2, 0]
      else
        [0, length xs, 0]
    modOne xs = xs
    expand h xs = concat $ zipWith replicate xs (cycle [h, 1-h])
  print $ (maximum (0:lenLens) + 1) `div` 2
  putStrLn $ " " `intercalate` (show `map` result2List)

module Main where
import Data.List
import Debug.Trace
import Data.List.Split

{-
split :: String -> [String]
split str = result where
  result
    | remain == "" = reslist
    | otherwise = remain:reslist
  (remain, reslist) = foldr process ("", []) str
  process ' ' ("", a) = ("", a)
  process ' ' (str, a) = ("", str:a)
  process c (str, a) = (c:str, a)
-}

summerize :: [Int] -> (Int, Int)
summerize xs = (head xs, length xs)

dupHeadTail :: [Int] -> [Int]
dupHeadTail xs@(x:_) = x:dupTail xs where
  dupTail (x:[]) = [x, x]
  dupTail (x:xs) = x:dupTail xs

remHeadTail :: [Int] -> [Int]
remHeadTail xss@(x:xs) = remTail xs where
  remTail (x:[]) = []
  remTail (x:xs) = x:remTail xs

main = do
  getLine -- for length, which we don't need
  input <- getLine
  let
    result1 = (maxOne + 1) `div` 2
    result2List = remHeadTail $ expand header result2Lens
    origList = dupHeadTail $ (read :: String -> Int) `map` splitOn " " input
    header = head origList
    lenList = length `map` group origList
    groupLen = group lenList
    lenLens = length `map` filter ((==1) . head) groupLen
    maxOne
      | lenLens == [] = 0
      | otherwise = maximum lenLens
    result2Lens = concat . map modOne $ groupLen
    modOne xs@(1:_) =
      if length xs `mod` 2 == 0 then
        [0, length xs `div` 2, length xs `div` 2, 0]
      else
        [0, length xs, 0]
    modOne xs = xs
    expand h xs = concat $ zipWith replicate xs (cycle [h, 1-h])
  print result1
  putStrLn $ " " `intercalate` (show `map` result2List)

import Control.Applicative
import Control.Monad
import Data.Maybe

splitAll :: [Int] -> [[Int]]

splitAll []
  = [[]]
splitAll [x]
  = [[x]]
splitAll [x,y]
  | x == y = [[x],[y]]
  | x /= y = [[x,y]]
splitAll (x:y:xs)
  | x == y && null rest = [x] : [[y]]
  | x == y              = [x] : rest
  | otherwise           = (x : h) : t
  where
    rest  = splitAll (y:xs)
    (h:t) = rest

change :: [Int] -> [Int]
change xs
  | n < 3  = xs
  | odd  n = arrOf (n-1) ft ++ [lt]
  | even n = arrOf hn ft ++ arrOf hn lt
  where
    n  = length xs
    hn = n `div` 2
    ft = head xs
    lt = last xs

    arrOf l v
      = take l $ repeat v

solve :: [Int] -> (Int,[Int])
solve xs
  = ( ans, concat arr' )
  where
    ans = ( maximum (map length arr) - 1 ) `div` 2
    arr  = splitAll xs
    arr' = map change arr

output :: (Int,[Int]) -> String
output (x, xs) = show x ++ "\n" ++ ( concat $ map (++ " ") (map show xs) )

main = ( output . solve . map ( read :: String -> Int ) . words . last . lines) <$> getContents >>= putStrLn

import Control.Applicative
import Control.Monad
import Data.Maybe

splitAll :: [Int] -> [[Int]]

splitAll []
  = [[]]
splitAll [x]
  = [[x]]
splitAll [x,y]
  | x == y = [[x],[y]]
  | x /= y = [[x,y]]
splitAll (x:y:xs)
  | x == y && null rest = [x] : [[y]]
  | x == y              = [x] : (y : h) : t
  | otherwise           = (x : h') : t'
  where
    rest  = splitAll xs
    (h:t) = rest

    rest'   = splitAll (y:xs)
    (h':t') = rest'

change :: [Int] -> [Int]
change xs
  | n < 2  = xs
  | odd  n = arrOf n ft
  | even n = arrOf hn ft ++ arrOf hn lt
  where
    n  = length xs
    hn = n `div` 2
    ft = head xs
    lt = last xs

    arrOf l v
      = take l $ repeat v

solve :: [Int] -> (Int,[Int])
solve xs
  = ( ans, concat arr' )
  where
    ans = ( maximum (map length arr) - 1 ) `div` 2
    arr  = splitAll xs
    arr' = map change arr

output :: (Int,[Int]) -> String
output (x, xs) = show x ++ "\n" ++ ( concat $ map (++ " ") (map show xs) )

main = ( output . solve . map ( read :: String -> Int ) . words . last . lines) <$> getContents >>= putStrLn

import Control.Applicative
import Control.Monad
import Data.Maybe

splitAll :: [Int] -> [[Int]]

splitAll []
  = [[]]
splitAll [x]
  = [[x]]
splitAll [x,y]
  | x == y = [[x],[y]]
  | x /= y = [[x,y]]
splitAll (x:y:xs)
  | x == y && null rest = [x] : [[y]]
  | x == y              = [x] : (y : h) : t
  | otherwise           = (x : h') : t'
  where
    rest  = splitAll xs
    (h:t) = rest

    rest'   = splitAll (y:xs)
    (h':t') = rest'

change :: [Int] -> [Int]
change xs
  | n < 3  = xs
  | odd  n = arrOf (n-1) ft ++ [lt]
  | even n = arrOf hn ft ++ arrOf hn lt
  where
    n  = length xs
    hn = n `div` 2
    ft = head xs
    lt = last xs

    arrOf l v
      = take l $ repeat v

solve :: [Int] -> (Int,[Int])
solve xs
  = ( ans, concat arr' )
  where
    ans = ( maximum (map length arr) - 1 ) `div` 2
    arr  = splitAll xs
    arr' = map change arr

output :: (Int,[Int]) -> String
output (x, xs) = show x ++ "\n" ++ ( concat $ map (++ " ") (map show xs) )

main = ( output . solve . map ( read :: String -> Int ) . words . last . lines) <$> getContents >>= putStrLn


import Data.List
main = interact $ unlines . s . map s . t . tail . lines
s = foldr (\x acc-> x:x:acc) []
t = transpose

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
  (_:h:_) <- map read . words <$> getLine
  s <- replicateM h $ getLine
  forM_ (transpose s) $
    replicateM_ 2 . putStrLn . double
  where
  double [] = []
  double (h:t) = h:h:double t

import Control.Applicative ((<$>))

main = do
	[w, h] <- map read . words <$> getLine
	a <- lines <$> getContents

	let b = [[a !! (y `div` 2) !! (x `div` 2) | y <- [0..2*h-1]] | x <- [0..2*w-1]]

	putStrLn $ unlines $ b

import Control.Applicative ((<$>))
import Data.List (transpose)

main = do
	-- [w, h] <- map read . words <$> getLine
	getLine
	a <- lines <$> getContents

	-- let b = [[a !! (y `div` 2) !! (x `div` 2) | y <- [0..2*h-1]] | x <- [0..2*w-1]]
	--

	let dup = concatMap (replicate 2)

	let b = dup . (map dup) $ transpose a

	putStrLn $ unlines $ b

module Main where
import Data.List
import Text.Read (read)
import System.IO

readArray:: Int->[String]->IO [String]
readArray 0 res = return res
readArray n res = do
                          s <-getLine
                          readArray (n-1) (res ++[s])

duplicate:: String->String
duplicate [] = []
duplicate (x:xs) = x:x:duplicate xs

duplicateV::[String]->[String]
duplicateV [] = []
duplicateV (cs:css) = cs:cs:duplicateV css

main = do
           mes <- getLine
           let w = read  (last . words $ mes)::Int
           --let h = read . last . words mes
           pic <- readArray w []
           putStrLn . (intercalate "\n") . duplicateV . (map  duplicate) . transpose $ pic

import Data.List
main = interact $ unlines . t . s . t . s . map r . t . r . tail . lines
s = concat . map (\x -> [x,x])
t = transpose
r = reverse

module Main where
import Data.List
import Text.Read (read)
import System.IO

readArray:: Int->[String]->IO [String]
readArray 0 res = return res
readArray n res = do
                          s <-getLine
                          readArray (n-1) (res ++[s])

duplicate:: String->String
duplicate [] = []
duplicate (x:xs) = x:x:duplicate xs
main = do
           mes <- getLine
           let w = read  (last . words $ mes)::Int
           --let h = read . last . words mes
           pic <- readArray w []
           putStrLn . (intercalate "\n") . (map  duplicate) . transpose $ pic


import qualified Data.Map as M
import Control.Monad
import Data.List --(foldl')

--calc :: Integer -> [Integer] -> Integer
calc n dat = ans
    where
      (idx, m, ans) = foldl' (\(i, mm, aa) t ->
            (i+1, M.insertWith (+) t 1 mm,
             aa + t * (i - n + 1 + i) - M.findWithDefault 0 (t-1) mm + M.findWithDefault 0 (t+1) mm
            ))
            (fromIntegral 0, M.empty, fromIntegral 0) dat

main :: IO ()
main = do
  n:dat <- fmap (map read . words) getContents :: IO [Integer]
  print $ calc n dat

import Data.List
import qualified Data.IntMap as Map

groupOn :: Int -> [a] -> [[a]]
groupOn _ [] = []
groupOn n xs = let (sts, nds) = splitAt n xs in sts : groupOn n nds
-------------------------------------------------------------------------------

main = interact $ unlines . parse . lines

parse [_,ops'] = sol ops
  where
    ops = fn $ words ops'
    fn :: [String] -> [Integer]
    fn xs = map read xs

d x y
  | abs (x-y) <= 1 = 0
  | otherwise      = y - x

type MM = Map.IntMap Int

sol as = [ show $ sol' m 0 0 as ]
  where
    m = Map.empty :: MM

sol' _ _ _ [] = 0
sol' m ss n (y:xs) = res + sol' (m `inc` y) (ss+y) (n+1) xs
  where
    (x,z)   = (y-1, y+1)
    (a,b,c) = (m`look`x, m`look`y, m`look`z)
    res = (n-a-b-c)*y - (ss - (x*a + y*b + z*c))

look :: MM -> Integer -> Integer
look m k = toInteger $ case Map.lookup (fromInteger k) m of
             Just v  -> v
             Nothing -> 0

inc :: MM -> Integer -> MM
inc m k = let
            ik = fromInteger k
            old = case Map.lookup ik m of
                    Just v  -> v
                    Nothing -> 0
  in Map.insert ik (old+1) m

module Main where
import qualified Data.ByteString.Char8 as B
import Data.List
import qualified Data.IntMap as M

main = B.interact exec
exec = B.pack . show . solve . map (maybe undefined fst . B.readInt) . tail . B.words
solve xs = sum $ zipWith3 (\p n x -> fromIntegral (p - n :: Int) * fromIntegral x) ps ns xs :: Integer
  where
  look = (maybe 0 id .) . M.lookup
  ps = snd $ mapAccumL (\m (l, x) -> (M.insertWith (+) x 1 m, l - look x m - look (x + 1) m - look (x - 1) m)) M.empty $ zip [0..] xs
  ns = snd $ mapAccumR (\(m, l) x -> ((M.insertWith (+) x 1 m, l + 1), l - look x m - look (x + 1) m - look (x - 1) m)) (M.empty, 0) xs

import Control.Arrow
import Control.Applicative
import qualified Data.Map as M

main :: IO ()
main = getContents >>= print . solve . map read . tail . words

solve :: [Integer] -> Integer
solve =
    sum
    . (
        zipWith3
        (\i v (s, m) -> v * i - s + sum [i * M.findWithDefault 0 (v + i) m | i <- [1, -1]])
        [0 ..]
        <*> scanl (flip $ \x -> (x +) *** (M.insertWith (+) x 1)) (0, M.empty)
    )

import qualified Data.Map as M
import Control.Monad
import Data.List --(foldl')

--calc :: Integer -> [Integer] -> Integer
calc n dat = ans
    where
      (idx, m, ans) = foldl' (\(i, mm, aa) t ->
            (i+1, M.insertWith (+) t 1 mm,
             aa + t * (i - n + 1 + i) - M.findWithDefault 0 (t-1) m + M.findWithDefault 0 (t+1) m
            ))
            (fromIntegral 0, M.empty, fromIntegral 0) dat

main :: IO ()
main = do
  n:dat <- fmap (map read . words) getContents :: IO [Integer]
  print $ calc n dat


import Control.Monad
import Data.Char

testCaseMain :: Int -> IO ()
testCaseMain _ = do s <- getLine
                    putStrLn (if map toLower s == "yes" then "YES" else "NO")

main :: IO ()
main = do n <- (readLn :: IO Int)
          forM_ [1 .. n] testCaseMain

module Main (main) where
import Numeric (showFFloat)
import Data.Char (toUpper)
-- reset && stack build && echo "success" && stack exec haskell-codeforces-exe && echo finished
--  gen-hie > hie.yaml

strToInt a = read a :: Int
strToFloat a = read a :: Float

pshow x = putStr (show x)
pfshow x = putStr (showFFloat (Just 2) x "")

solve:: String -> String
solve str = do
  let x = map toUpper str
  if x == "YES" then "YES"
   else "NO"

fnMain :: String -> String
fnMain input = do
    let inputLines = lines input

    let n = strToInt $ head $ inputLines
    unlines $ map solve $ take n $ drop 1 $ inputLines

main :: IO ()
main = do
    interact fnMain

import Control.Arrow ((>>>))
import Data.Char (toLower)

main = interact $ lines >>> drop 1 >>> map processTest >>> unlines

processTest = map toLower >>> (== "yes") >>> (\ isYes -> if isYes then "YES" else "NO")

import Data.List
import Data.Text(toLower,pack,unpack)

testcase 0 = return ()
testcase t = do
    s <- getLine
    putStrLn (if (unpack $ toLower $ pack $ s) == "yes"
        then "YES" else "NO")
    testcase (t - 1)

main :: IO ()
main = do
    t <- read <$> getLine
    testcase t

{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Control.Monad.State
import qualified Data.ByteString.Char8 as C
import Data.Maybe

--
import Data.Bool
import Data.Char

solve :: C.ByteString -> Bool
solve = (== "yes") . C.map toLower

input = bstr

output :: Bool -> C.ByteString
output = bool "NO" "YES"

main :: IO ()
main = C.interact $ C.unlines . map (output . solve) . runScanner (numberOf input)

-- Scanner

type Scanner = State [C.ByteString]

runScanner :: Scanner a -> C.ByteString -> a
runScanner = runScannerWith C.words

runScannerWith :: (C.ByteString -> [C.ByteString]) -> Scanner a -> C.ByteString -> a
runScannerWith sp sc = evalState sc . sp

bstr :: Scanner C.ByteString
bstr = get >>= \case s : ss -> put ss >> pure s

read' :: (C.ByteString -> Maybe (a, C.ByteString)) -> Scanner a
read' q = fst . fromJust . q <$> bstr

int :: Scanner Int
int = read' C.readInt

integer :: Scanner Integer
integer = read' C.readInteger

(><) :: Int -> Scanner a -> Scanner [a]
(><) = replicateM

numberOf :: Scanner a -> Scanner [a]
numberOf = (int >>=) . flip (><)

{-# LANGUAGE LambdaCase #-}
module Main where

import Control.Monad (liftM2, replicateM_, replicateM, foldM, when)
import Data.Char (digitToInt, toLower)
import Data.Maybe (fromJust, fromMaybe)
import qualified Data.ByteString.Char8 as C
import Data.Map.Strict (Map, insert, alter, empty, (!), (!?), fromList, fromListWith, mapWithKey, findWithDefault, unionWithKey, traverseWithKey, mapKeys, filterWithKey, mapKeysWith)
import Data.List (group, sort)
import Data.Set (Set, deleteFindMin, union)
import qualified Data.Set as Set
import qualified Data.Map.Strict as Map
import Data.Function (on)
-- import System.Random
import Data.Array.MArray (newArray, readArray, writeArray, newListArray)
import Data.Array.IO (IOUArray, getElems)
import Debug.Trace
import Data.Bool (bool)
import Data.Foldable (foldlM)
import Control.Arrow ((&&&))

-- road map in reverse, and the number of cities, init pen state
type Domain = String
type CoDomain = String
type Solver  = Domain -> CoDomain

readChar8 :: IO [Int]
readChar8 = fmap (fst . fromJust) . fmap C.readInt . C.words <$> C.getLine

printAns :: CoDomain -> IO ()
printAns = putStrLn

parse :: IO Domain
parse = do
  line <- getLine
  return line

solve :: Solver
solve =  (\x -> if x then "YES" else "NO") . (=="yes") . fmap toLower

main :: IO ()
main = do
  [n] <- readChar8
  replicateM n $ printAns =<< solve <$> parse
  return ()

{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RecordWildCards #-}

import Control.Applicative (Applicative (liftA2))
import Control.Arrow ((>>>))
import Control.Monad (forM_)
import Control.Monad.State (MonadState (get, put), State, evalState, gets, replicateM)
import Data.Array ((!))
import Data.Array.ST (MArray (newArray), readArray, runSTArray, writeArray)
import qualified Data.ByteString.Char8 as C
import Data.Char (toLower)
import Data.Maybe (fromJust)

data TC = TC {s :: String}

solve TC {..} = case fmap toLower s == "yes" of
  True -> "YES"
  otherwise -> "NO"

main = C.interact $ runScanner scan >>> map solve >>> map (C.pack) >>> C.unlines

scan = numberOf $ TC <$> C.unpack <$> str

type Scanner = State [C.ByteString]

runScanner :: Scanner a -> C.ByteString -> a
runScanner = runScannerWith C.words

runScannerWith :: (C.ByteString -> [C.ByteString]) -> Scanner a -> C.ByteString -> a
runScannerWith t s = evalState s . t

peek :: Scanner C.ByteString
peek = gets head

str :: Scanner C.ByteString
str = get >>= \case s : ss -> put ss >> return s

int :: Scanner Int
int = fst . fromJust . C.readInt <$> str

integer :: Scanner Integer
integer = read . C.unpack <$> str

double :: Scanner Double
double = read . C.unpack <$> str

decimal :: Int -> Scanner Int
decimal p = round . ((10 ^ p) *) <$> double

numberOf :: Scanner a -> Scanner [a]
numberOf s = int >>= flip replicateM s

many :: Scanner a -> Scanner [a]
many s = get >>= \case [] -> return []; _ -> (:) <$> s <*> many s

till :: (C.ByteString -> Bool) -> Scanner a -> Scanner [a]
till p s = do
  t <- peek
  if p t then return [] else (:) <$> s <*> till p s

times :: Int -> Scanner a -> Scanner [a]
times = replicateM

(><) = times

two, three, four :: Scanner a -> Scanner [a]
[two, three, four] = map times [2 .. 4]

pair :: Scanner a -> Scanner b -> Scanner (a, b)
pair = liftA2 (,)

import           Data.List
import qualified Data.Char as DC

isyes :: String -> Bool
isyes s = (map DC.toLower s == "yes")

solveCase :: IO ()
solveCase = do
    s <- getLine
    putStrLn $ if isyes s then "YES" else "NO"

solve :: Int -> IO ()
solve 0 = do
    return ()
solve cases_left = do
    solveCase
    solve $ cases_left - 1

main = do
    s_testcases <- getLine
    solve $ (read s_testcases :: Int)


import Data.List
import Data.Function (on)
f s = map head $ filter ((>1).length) $ group $ sort s
main = do
    [n, m] <- (map read . words) `fmap` getLine
    l <- concat `fmap` mapM (\i -> do
        l' <- getLine
        return $ map (\(c, j) -> (c, (i, j))) $ zip l' [1..]) [1..n]
    let l' = groupBy ((==) `on` fst) $ sort l
    let l2 = sortBy (\(c1, ab1) (c2, ab2) -> ab1 `compare` ab2) $ concatMap (\l -> let
            fl = f $ map (fst.snd) l
            sl = f $ map (snd.snd) l in
            filter (\(c, (a, b)) -> (a `notElem` fl) && (b `notElem` sl)) l) l'
    putStrLn $ map fst l2

module Main where

import Control.Monad
import Control.Monad.ST
import Data.List
import Data.Array.Unboxed
import Data.Array.ST

modifyArray :: (MArray a e m, Ix i) => a i e -> i -> (e -> e) -> m ()
modifyArray a i f = readArray a i >>= \x -> writeArray a i (f x)

rowCrossMask :: [Char] -> [Bool]
rowCrossMask row =
    let mask = runSTUArray $ do
            mask <- newArray ('a','z') 0 :: ST s (STUArray s Char Int)
            forM row $ \ch -> modifyArray mask ch (+1)
            return mask
    in map (\ch -> if mask ! ch == 1 then True else False) row

main = do
    [h, w] <- ( map read . words ) `liftM` getLine
    board <- replicateM h getLine

    let rowCross = join $ map rowCrossMask board
        colCross = join $ transpose $ map rowCrossMask $ transpose board
        allCross = map snd $ filter fst $ zip (zipWith (&&) rowCross colCross) (join board)

    --putStrLn $ show rowCross
    --putStrLn $ show colCross
    putStrLn allCross

import Array

type Africa = Array (Int, Int) (Either Char Char)

bigTest :: [String]
bigTest = take 100 (repeat (take 100 (cycle "a")))

genAfrica :: (Int, Int) -> [String] -> Africa
genAfrica (n, m) lines = array ((1, 1), (n, m)) [((i, j), Right (lines !! (i-1) !! (j-1))) | i <- [1..n], j <- [1..m]]

getEither :: Either a a -> a
getEither (Left  a) = a
getEither (Right a) = a

getJust :: Maybe a -> a
getJust (Just a)  =  a
getJust Nothing   =  error "Nothing!"

findEqLeft :: (Int, Int) -> (Int, Int) -> Africa -> Maybe (Int, Int)
findEqLeft size (x, y) africa = findEqLeft' size (x, y) (x, y + 1) africa
  where
    findEqLeft' :: (Int, Int) -> (Int, Int) -> (Int, Int) -> Africa -> Maybe (Int, Int)
    findEqLeft' (n, m) (x, y) (i, j) africa
      | j > m  =  Nothing
      | getEither (africa ! (x, y)) == getEither (africa ! (i, j))  =  Just (i, j)
      | otherwise  =  findEqLeft' (n, m) (x, y) (i, j + 1) africa

findEqDown :: (Int, Int) -> (Int, Int) -> Africa -> Maybe (Int, Int)
findEqDown size (x, y) africa = findEqDown' size (x, y) (x + 1, y) africa
  where
    findEqDown' :: (Int, Int) -> (Int, Int) -> (Int, Int) -> Africa -> Maybe (Int, Int)
    findEqDown' (n, m) (x, y) (i, j) africa
      | i > n  =  Nothing
      | getEither (africa ! (x, y)) == getEither (africa ! (i, j))  =  Just (i, j)
      | otherwise  =  findEqDown' (n, m) (x, y) (i + 1, j) africa

filterAfrica :: (Int, Int) -> Africa -> Africa
filterAfrica (n, m) africa = foldl (\africa (x, y) -> filterAfrica' (n, m) (x, y) africa) africa [(i, j) | i <- [1..n], j <- [1..m]]
  where
    filterAfrica' :: (Int, Int) -> (Int, Int) -> Africa -> Africa
    filterAfrica' size cell africa
      | nextLeft == Nothing && nextDown == Nothing  =  africa
      | nextLeft /= Nothing && nextDown == Nothing  =  africa // [(cell, Left symbol), (getJust nextLeft, Left symbol)]
      | nextLeft == Nothing && nextDown /= Nothing  =  africa // [(cell, Left symbol), (getJust nextDown, Left symbol)]
      | nextLeft /= Nothing && nextDown /= Nothing  =  africa // [(cell, Left symbol), (getJust nextLeft, Left symbol), (getJust nextDown, Left symbol)]
      where
        nextLeft  =  findEqLeft size cell africa
        nextDown  =  findEqDown size cell africa
        symbol    =  getEither (africa ! cell)

getSymbols :: (Either Char Char) -> String
getSymbols (Left  _) = []
getSymbols (Right c) = [c]

printAfrica :: (Int, Int) -> Africa -> String
printAfrica (n, m) africa = concatMap (\cell -> getSymbols (africa ! cell))  [(i, j) | i <- [1..n], j <- [1..m]]

main = do
  line <- getLine
  let [n, m] = map read $ words line
  let size = (n, m)
  lines <- sequence (map (\x -> getLine) [1..n])
  putStrLn $ printAfrica size $ filterAfrica size $ genAfrica size lines

{-# LANGUAGE BangPatterns, ViewPatterns, PatternGuards, ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-orphans #-}

import Control.Applicative
import Control.Monad
import Data.Array.IO

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  buf   <- newArray  ((1, 1, 'a'), (n, m, 'z')) 0 :: IO (IOUArray (Int, Int, Char) Int)
  table <- newArray_ ((1, 1), (n, m))             :: IO (IOUArray (Int, Int) Char)
  forM_ [1 .. n] $ \y -> do
    s <- take m <$> getLine
    forM_ (zip [1 ..] s) $ \(x, c) -> do
      writeArray table (y, x) c
      forM_ [1 .. n] $ \y' -> do
        v <- readArray buf (y', x, c)
        writeArray buf (y', x, c) $ v + 1
      forM_ [1 .. m] $ \x' -> do
        v <- readArray buf (y, x', c)
        when (x' /= x) $
          writeArray buf (y, x', c) $ v + 1
  forM_ [1 .. n] $ \y ->
    forM_ [1 .. m] $ \x -> do
      c <- readArray table (y, x)
      v <- readArray buf (y, x, c)
      when (v == 1) $ putChar c
  putStrLn ""

import Control.Applicative
import Control.Monad
import Data.Array
import Data.Char

main = do
   [n,m] <- map read . words <$> getLine
   cw <- listArray ((1,1),(n,m)) . filter isAlpha . concat <$> replicateM n getLine
   let wr = listArray ((1,1),(n,m)) [ not $ (or [ cw!(n',c) == cw!(r,c) | n' <- [1..n], n' /= r]) || (or [cw!(r,n') == cw!(r,c) | n' <- [1..m], n' /= c ])
                                             | r <- [1..n], c <- [1..m]]
   putStrLn $ map fst $ filter snd $ zip (elems cw) (elems wr)