module Main where

import Control.Monad
import Data.Array.IO
import Data.Array
import Data.List
import Data.Ix

data SegTree w a = SegTree w (SegNode a) deriving Show
data SegNode a = SegLeave a | SegBranch a (SegNode a) (SegNode a) deriving Show

newSegTree :: (Integral w, Num v) => w -> v -> SegTree w v
newSegTree w v =
    let newSegNode w v =
            if w == 1
            then SegLeave v
            else let
                w1 = w `div` 2
                w2 = w - w1
            in SegBranch (v * (fromIntegral w)) (newSegNode w1 v) (newSegNode w2 v)
    in SegTree w $ newSegNode w v

updateSegTree :: (Integral i, Num a) => SegTree i a -> i -> a -> SegTree i a
updateSegTree (SegTree w n) i v =
    let updateSegNode (SegLeave v0) w i v = SegLeave (v0+v)
        updateSegNode (SegBranch v0 left right) w i v =
            let w1 = w `div` 2
                w2 = w - w1
                (left', right') = if i < w1
                    then (updateSegNode left w1 i v, right)
                    else (left, updateSegNode right w2 (i-w1) v)
            in SegBranch (v0+v) left' right'
    in SegTree w (updateSegNode n w i v)

pickSegTree :: (Integral i, Num a) => SegTree i a -> i -> a
pickSegTree (SegTree w n) i =
    let pickSegNode (SegLeave v) _ _ = v
        pickSegNode (SegBranch v left right) w i =
            let w1 = w `div` 2
                w2 = w - w1
            in if i < w1
            then pickSegNode left w1 i
            else pickSegNode right w2 (i-w1)
    in pickSegNode n w i

leftHalfSegTree :: (Integral i, Num a) => SegTree i a -> i -> a
leftHalfSegTree (SegTree w n) i =
    let leftHalfSegNode (SegLeave v) w i = if i < 0
            then 0
            else v
        leftHalfSegNode (SegBranch v left right) w i =
            let w1 = w `div` 2
                w2 = w - w1
            in if i < 0
            then 0
            else if i < w
            then leftHalfSegNode left w1 i + leftHalfSegNode right w2 (i-w1)
            else v
    in leftHalfSegNode n w i

showName n = case (n-1) `mod` 3 of
    0 -> "Carrots"
    1 -> "Kiwis"
    2 -> "Grapes"

main = do
    [n, m, k, t] <- ( map read . words ) `liftM` getLine

    let seg = newSegTree (n*m) 1
    --putStrLn $ show seg

    seg' <-iterate (\seg0' -> do
            seg0 <- seg0'
            [a, b] <- ( map read . words ) `liftM` getLine
            return $ updateSegTree seg0 ((a-1)*m+(b-1)) (-1)
        ) (return seg) !! k
    --putStrLn $ show seg'

    replicateM_ t $ do
        [i, j] <- ( map read . words ) `liftM` getLine
        let p = (i-1)*m+(j-1)

        if pickSegTree seg' p == 0
            then putStrLn "Waste"
            else putStrLn $ showName $ leftHalfSegTree seg' p

nth :: Int -> [(Int, Int)] -> Int -> Int -> Int
nth m block i j
	| elem (i, j) block = 3
	| otherwise = (m * (i-1) + (j-1) - (length . filter (\(x,y) -> x < i || x == i && y < j)) block) `mod` 3

getLines :: Int -> IO [(Int, Int)]
getLines 0 = return []
getLines n = do x <- getLine >>= return . (\x -> (head x, last x)) . map read . words; xs <- getLines (n-1); return (x:xs)

main = do
	[n,m,k,t] <- getLine >>= return . map read . words :: IO [Int]
	block <- getLines k
	query <- getLines t
	(putStr . unlines . map (\i -> ["Carrots", "Kiwis", "Grapes", "Waste"] !! i)) [ nth m block x y | (x,y) <- query ]

import Data.List

main = interact $ unlines . solve . map (map read . words) . lines

solve :: [[Int]] -> [String]
solve ((n:m:k:t:_):xs) = map (f m wastes) queries
  where
  wastes = sort $ take k xs
  queries = take t $ drop k xs

f :: Int -> [[Int]] -> [Int] -> String
f m wastes query@[x,y]
  | not (null b) && head b == query = "Waste"
  | otherwise = ["Carrots", "Kiwis", "Grapes"] !! rem (x*m-m+y-1-length a) 3
  where
  (a, b) = span (< query) wastes

import List

type Cell = (Int, Int)

number :: (Int, Int) -> Int -> Cell -> Int
number      range    cntEmpty  cell  = (fst cell - 1) * snd range + snd cell - cntEmpty

numberCell :: (Int, Int) -> [Cell] -> Cell -> Int
numberCell    range        emptyCells cell  = numberCell' range 0 emptyCells cell
  where
    numberCell' range cntEmpty []       cell  = number range cntEmpty cell
    numberCell' range cntEmpty (ec:ecs) cell
      | ec < cell  =  numberCell' range (cntEmpty + 1) ecs cell
      | ec > cell  =  numberCell' range cntEmpty [] cell
      | otherwise  =  0

ans :: Int -> String
ans 0  =  "Waste"
ans 1  =  "Carrots"
ans 2  =  "Kiwis"
ans 3  =  "Grapes"
ans n  =  ans (mod (n - 1) 3 + 1)

printAns :: [Int] -> IO ()
printAns [] = return ()
printAns (x:xs) = do
  putStrLn $ ans x
  printAns xs

readCell :: Int -> IO Cell
readCell _ = do
  line <- getLine
  let [a, b] = map read $ words line
  return (a, b)

main = do
  line <- getLine
  let [n, m, k, t] = map read $ words line
  emptyCells <- sequence (map readCell [1..k])
  cells      <- sequence (map readCell [1..t])
  printAns (map (numberCell (n, m) (sort emptyCells)) cells)

{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, BangPatterns, PatternGuards, ViewPatterns, RecordWildCards, ForeignFunctionInterface, CPP, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ImplicitParams #-}
{-# OPTIONS_GHC -O2 -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-unused-imports #-}

import Control.Applicative
import Control.Monad
import Foreign
import Foreign.C
import Data.List
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as BS
-- import qualified Data.Map as Map
import qualified Data.IntSet as Set

main :: IO ()
main = do
  _   :: Int        <- input
  m   :: Int        <- input
  k   :: Int        <- input
  t   :: Int        <- input
  let checkWasteCells acc !i | i >= k     = return acc
                             | otherwise  = do
                                 a   :: Int        <- input
                                 b   :: Int        <- input
                                 checkWasteCells (Set.insert ((a - 1) * m + (b - 1)) acc) (i + 1)
  wasteCells <- checkWasteCells Set.empty 0
  let a          = listArray (0, k - 1) (Set.toList wasteCells)     :: UArray Int Int
      candidates = listArray (0, 2) ["Carrots", "Kiwis", "Grapes"]  :: Array  Int String
  rep t $ \_ -> do
    i   :: Int        <- input
    j   :: Int        <- input
    let !v = (i - 1) * m + (j - 1)
    if Set.member v wasteCells
      then output' ("Waste" :: String)
      else do
        let loop !n | n < k, a ! n <= v   = loop (n + 1)
                    | otherwise           = do
                        let idx = (v - n) `mod` 3
                        output'  $ candidates ! idx
        loop 0

--------------------------------------------------
-- Imported C functions
--------------------------------------------------
#define BUFMAX                (100005)

type BString = BS.ByteString

foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i     :: CString -> Ptr Int   -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i64   :: CString -> Ptr Int64 -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_f     :: CString -> Ptr Float -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_s     :: CString -> CString   -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i    :: CString -> Int       -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i64  :: CString -> Int64     -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_d    :: CString -> Double    -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_s    :: CString -> CString   -> IO ()

fmt_i, fmt_i64, fmt_f, fmt_d, fmt_s :: CString
fmt_i   = unsafePerformIO $ newCString "%d"
fmt_i64 = unsafePerformIO $ newCString "%I64d"
fmt_f   = unsafePerformIO $ newCString "%f"
fmt_d   = unsafePerformIO $ newCString "%.16f"
fmt_s   = unsafePerformIO $ newCString "%s"
{-# NOINLINE fmt_i    #-}
{-# NOINLINE fmt_i64  #-}
{-# NOINLINE fmt_f    #-}
{-# NOINLINE fmt_d    #-}
{-# NOINLINE fmt_s    #-}

ptr_i   :: Ptr Int
ptr_i   = unsafePerformIO malloc
ptr_i64 :: Ptr Int64
ptr_i64 = unsafePerformIO malloc
ptr_f   :: Ptr Float
ptr_f   = unsafePerformIO malloc
ptr_d   :: Ptr Double
ptr_d   = unsafePerformIO malloc
ptr_s   :: CString
ptr_s   = unsafePerformIO $ mallocArray BUFMAX
{-# NOINLINE ptr_i    #-}
{-# NOINLINE ptr_i64  #-}
{-# NOINLINE ptr_f    #-}
{-# NOINLINE ptr_d    #-}
{-# NOINLINE ptr_s    #-}

class Input a           where
  input :: IO a

instance Input Int      where
  input = c_scanf_i fmt_i ptr_i >> peek ptr_i
instance Input Int64    where
  input = c_scanf_i64 fmt_i64 ptr_i64 >> peek ptr_i64
instance Input Integer  where
  input = toInteger <$> (input :: IO Int64)
instance Input Double   where
  input = c_scanf_f fmt_f ptr_f >> realToFrac <$> peek ptr_f
instance Input String   where
  input = c_scanf_s fmt_s ptr_s >> peekCString ptr_s
instance Input BString  where
  input = c_scanf_s fmt_s ptr_s >> BS.packCString ptr_s

class Output a          where
  output_   :: a -> IO ()
  output    :: a -> IO ()
  output    = (>> space  ) . output_
  output'   :: a -> IO ()
  output'   = (>> newline) . output_

instance Output Int     where
  output_   = c_printf_i fmt_i
instance Output Int64   where
  output_   = c_printf_i64 fmt_i64
instance Output Integer where
  output_   = output_ . show
instance Output Double  where
  output_   = c_printf_d fmt_d
instance Output String  where
  output_   = flip withCString (c_printf_s fmt_s)
instance Output BString where
  output_   = flip BS.useAsCString (c_printf_s fmt_s)

space   :: IO ()
space   = output_ (" "  :: String)

newline :: IO ()
newline = output_ ("\n" :: String)

for :: Int -> Int -> (Int -> IO ()) -> IO ()
for !begin !end k = loop begin
  where loop !i | i >= end  = return ()
                | otherwise = k i >> loop (i + 1)

rep :: Int -> (Int -> IO ()) -> IO ()
rep = for 0

nth :: Int -> [(Int, Int)] -> Int -> Int -> Int
nth m block i j
	| elem (i, j) block = 3
	| otherwise = (m * i + j - (length . filter (\(x,y) -> x < i || x == i && y < j)) block) `mod` 3

getLines :: Int -> IO [(Int, Int)]
getLines 0 = return []
getLines n = do x <- getLine >>= return . (\x -> (head x, last x)) . map read . words; xs <- getLines (n-1); return (x:xs)

main = do
	[n,m,k,t] <- getLine >>= return . map read . words :: IO [Int]
	block <- getLines k
	query <- getLines t
	(putStr . unlines . map (\i -> ["Carrots", "Kiwis", "Grapes", "Waste"] !! i)) [ nth m block x y | (x,y) <- query ]

import List

type Cell = (Int, Int)

number :: (Int, Int) -> Int -> Cell -> Int
number      range    cntEmpty  cell  = (fst cell - 1) * snd range + snd cell - cntEmpty

numberCell :: (Int, Int) -> [Cell] -> Cell -> Int
numberCell    range        emptyCells cell  = numberCell' range 0 emptyCells cell
  where
    numberCell' range cntEmpty []       cell  = number range cntEmpty cell
    numberCell' range cntEmpty (ec:ecs) cell
      | ec < cell  =  numberCell' range (cntEmpty + 1) ecs cell
      | ec > cell  =  numberCell' range cntEmpty [] cell
      | otherwise  =  0

ans :: Int -> String
ans 0  =  "Waste"
ans 1  =  "Carrots"
ans 2  =  "Kiwis"
ans 3  =  "Grapes"
ans n  =  ans (mod (n - 1) 3 + 1)

printAns :: [Int] -> IO ()
printAns [] = return ()
printAns (x:xs) = do
  print $ ans x
  printAns xs

readCell :: Int -> IO Cell
readCell _ = do
  line <- getLine
  let [a, b] = map read $ words line
  return (a, b)

main = do
  line <- getLine
  let [n, m, k, t] = map read $ words line
  emptyCells <- sequence (map readCell [1..k])
  cells      <- sequence (map readCell [1..t])
  printAns (map (numberCell (n, m) (sort emptyCells)) cells)

{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, BangPatterns, PatternGuards, ViewPatterns, RecordWildCards, ForeignFunctionInterface, CPP, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ImplicitParams #-}
{-# OPTIONS_GHC -O2 -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-unused-imports #-}

import Control.Applicative
import Control.Monad
import Foreign
import Foreign.C
import Data.List
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as BS
-- import qualified Data.Map as Map
import qualified Data.IntSet as Set

main :: IO ()
main = do
  _   :: Int        <- input
  m   :: Int        <- input
  k   :: Int        <- input
  t   :: Int        <- input
  let checkWasteCells acc !i | i >= k     = return acc
                             | otherwise  = do
                                 a   :: Int        <- input
                                 b   :: Int        <- input
                                 checkWasteCells (Set.insert ((a - 1) * m + (b - 1)) acc) (i + 1)
  wasteCells <- checkWasteCells Set.empty 0
  let a          = listArray (0, k - 1) (Set.toList wasteCells)     :: UArray Int Int
      candidates = listArray (0, 2) ["Carrots", "Kiwis", "Grapes"]  :: Array  Int String
  rep t $ \_ -> do
    i   :: Int        <- input
    j   :: Int        <- input
    let !v = (i - 1) * m + (j - 1)
    if Set.member v wasteCells
      then output' ("Waste" :: String)
      else do
        let loop !n | n < k, v <= a ! n   = loop (n + 1)
                    | otherwise           = do
                        let idx = (v - (n + 1)) `mod` 3
                        output'  $ candidates ! idx
        loop 0

--------------------------------------------------
-- Imported C functions
--------------------------------------------------
#define BUFMAX                (100005)

type BString = BS.ByteString

foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i     :: CString -> Ptr Int   -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i64   :: CString -> Ptr Int64 -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_f     :: CString -> Ptr Float -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_s     :: CString -> CString   -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i    :: CString -> Int       -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i64  :: CString -> Int64     -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_d    :: CString -> Double    -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_s    :: CString -> CString   -> IO ()

fmt_i, fmt_i64, fmt_f, fmt_d, fmt_s :: CString
fmt_i   = unsafePerformIO $ newCString "%d"
fmt_i64 = unsafePerformIO $ newCString "%I64d"
fmt_f   = unsafePerformIO $ newCString "%f"
fmt_d   = unsafePerformIO $ newCString "%.16f"
fmt_s   = unsafePerformIO $ newCString "%s"
{-# NOINLINE fmt_i    #-}
{-# NOINLINE fmt_i64  #-}
{-# NOINLINE fmt_f    #-}
{-# NOINLINE fmt_d    #-}
{-# NOINLINE fmt_s    #-}

ptr_i   :: Ptr Int
ptr_i   = unsafePerformIO malloc
ptr_i64 :: Ptr Int64
ptr_i64 = unsafePerformIO malloc
ptr_f   :: Ptr Float
ptr_f   = unsafePerformIO malloc
ptr_d   :: Ptr Double
ptr_d   = unsafePerformIO malloc
ptr_s   :: CString
ptr_s   = unsafePerformIO $ mallocArray BUFMAX
{-# NOINLINE ptr_i    #-}
{-# NOINLINE ptr_i64  #-}
{-# NOINLINE ptr_f    #-}
{-# NOINLINE ptr_d    #-}
{-# NOINLINE ptr_s    #-}

class Input a           where
  input :: IO a

instance Input Int      where
  input = c_scanf_i fmt_i ptr_i >> peek ptr_i
instance Input Int64    where
  input = c_scanf_i64 fmt_i64 ptr_i64 >> peek ptr_i64
instance Input Integer  where
  input = toInteger <$> (input :: IO Int64)
instance Input Double   where
  input = c_scanf_f fmt_f ptr_f >> realToFrac <$> peek ptr_f
instance Input String   where
  input = c_scanf_s fmt_s ptr_s >> peekCString ptr_s
instance Input BString  where
  input = c_scanf_s fmt_s ptr_s >> BS.packCString ptr_s

class Output a          where
  output_   :: a -> IO ()
  output    :: a -> IO ()
  output    = (>> space  ) . output_
  output'   :: a -> IO ()
  output'   = (>> newline) . output_

instance Output Int     where
  output_   = c_printf_i fmt_i
instance Output Int64   where
  output_   = c_printf_i64 fmt_i64
instance Output Integer where
  output_   = output_ . show
instance Output Double  where
  output_   = c_printf_d fmt_d
instance Output String  where
  output_   = flip withCString (c_printf_s fmt_s)
instance Output BString where
  output_   = flip BS.useAsCString (c_printf_s fmt_s)

space   :: IO ()
space   = output_ (" "  :: String)

newline :: IO ()
newline = output_ ("\n" :: String)

for :: Int -> Int -> (Int -> IO ()) -> IO ()
for !begin !end k = loop begin
  where loop !i | i >= end  = return ()
                | otherwise = k i >> loop (i + 1)

rep :: Int -> (Int -> IO ()) -> IO ()
rep = for 0

{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, BangPatterns, PatternGuards, ViewPatterns, RecordWildCards, ForeignFunctionInterface, CPP, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ImplicitParams #-}
{-# OPTIONS_GHC -O2 -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-unused-imports #-}

import Control.Applicative
import Control.Monad
import Foreign
import Foreign.C
import Data.List
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as BS
-- import qualified Data.Map as Map
import qualified Data.IntSet as Set

main :: IO ()
main = do
  _   :: Int        <- input
  m   :: Int        <- input
  k   :: Int        <- input
  t   :: Int        <- input
  let checkWasteCells acc !i | i > k      = return acc
                             | otherwise  = do
                                 a   :: Int        <- input
                                 b   :: Int        <- input
                                 checkWasteCells (Set.insert (a * m + b) acc) (i + 1)
  wasteCells <- checkWasteCells Set.empty 1
  let a          = listArray (1, k) (Set.toList wasteCells)         :: UArray Int Int
      candidates = listArray (0, 2) ["Carrots", "Kiwis", "Grapes"]  :: Array  Int String
  rep t $ \_ -> do
    i   :: Int        <- input
    j   :: Int        <- input
    let !v = i * m + j
    if Set.member v wasteCells
      then output' ("Waste" :: String)
      else do
        let loop !n | n <= k, v <= v'   = loop (n + 1)
                    | otherwise = do
                        let idx = (v - n) `mod` 3
                        output'  $ candidates ! idx
              where v' = a ! n
        loop 1

--------------------------------------------------
-- Imported C functions
--------------------------------------------------
#define BUFMAX                (100005)

type BString = BS.ByteString

foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i     :: CString -> Ptr Int   -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i64   :: CString -> Ptr Int64 -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_f     :: CString -> Ptr Float -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_s     :: CString -> CString   -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i    :: CString -> Int       -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i64  :: CString -> Int64     -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_d    :: CString -> Double    -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_s    :: CString -> CString   -> IO ()

fmt_i, fmt_i64, fmt_f, fmt_d, fmt_s :: CString
fmt_i   = unsafePerformIO $ newCString "%d"
fmt_i64 = unsafePerformIO $ newCString "%I64d"
fmt_f   = unsafePerformIO $ newCString "%f"
fmt_d   = unsafePerformIO $ newCString "%.16f"
fmt_s   = unsafePerformIO $ newCString "%s"
{-# NOINLINE fmt_i    #-}
{-# NOINLINE fmt_i64  #-}
{-# NOINLINE fmt_f    #-}
{-# NOINLINE fmt_d    #-}
{-# NOINLINE fmt_s    #-}

ptr_i   :: Ptr Int
ptr_i   = unsafePerformIO malloc
ptr_i64 :: Ptr Int64
ptr_i64 = unsafePerformIO malloc
ptr_f   :: Ptr Float
ptr_f   = unsafePerformIO malloc
ptr_d   :: Ptr Double
ptr_d   = unsafePerformIO malloc
ptr_s   :: CString
ptr_s   = unsafePerformIO $ mallocArray BUFMAX
{-# NOINLINE ptr_i    #-}
{-# NOINLINE ptr_i64  #-}
{-# NOINLINE ptr_f    #-}
{-# NOINLINE ptr_d    #-}
{-# NOINLINE ptr_s    #-}

class Input a           where
  input :: IO a

instance Input Int      where
  input = c_scanf_i fmt_i ptr_i >> peek ptr_i
instance Input Int64    where
  input = c_scanf_i64 fmt_i64 ptr_i64 >> peek ptr_i64
instance Input Integer  where
  input = toInteger <$> (input :: IO Int64)
instance Input Double   where
  input = c_scanf_f fmt_f ptr_f >> realToFrac <$> peek ptr_f
instance Input String   where
  input = c_scanf_s fmt_s ptr_s >> peekCString ptr_s
instance Input BString  where
  input = c_scanf_s fmt_s ptr_s >> BS.packCString ptr_s

class Output a          where
  output_   :: a -> IO ()
  output    :: a -> IO ()
  output    = (>> space  ) . output_
  output'   :: a -> IO ()
  output'   = (>> newline) . output_

instance Output Int     where
  output_   = c_printf_i fmt_i
instance Output Int64   where
  output_   = c_printf_i64 fmt_i64
instance Output Integer where
  output_   = output_ . show
instance Output Double  where
  output_   = c_printf_d fmt_d
instance Output String  where
  output_   = flip withCString (c_printf_s fmt_s)
instance Output BString where
  output_   = flip BS.useAsCString (c_printf_s fmt_s)

space   :: IO ()
space   = output_ (" "  :: String)

newline :: IO ()
newline = output_ ("\n" :: String)

for :: Int -> Int -> (Int -> IO ()) -> IO ()
for !begin !end k = loop begin
  where loop !i | i >= end  = return ()
                | otherwise = k i >> loop (i + 1)

rep :: Int -> (Int -> IO ()) -> IO ()
rep = for 0

{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, BangPatterns, PatternGuards, ViewPatterns, RecordWildCards, ForeignFunctionInterface, CPP, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ImplicitParams #-}
{-# OPTIONS_GHC -O2 -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-unused-imports #-}

import Control.Applicative
import Control.Monad
import Foreign
import Foreign.C
import Data.List
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as BS
-- import qualified Data.Map as Map
import qualified Data.IntSet as Set

main :: IO ()
main = do
  _   :: Int        <- input
  m   :: Int        <- input
  k   :: Int        <- input
  t   :: Int        <- input
  let checkWasteCells acc !i | i >= k     = return acc
                             | otherwise  = do
                                 a   :: Int        <- input
                                 b   :: Int        <- input
                                 checkWasteCells (Set.insert ((a - 1) * m + (b - 1)) acc) (i + 1)
  wasteCells <- checkWasteCells Set.empty 0
  let a          = listArray (0, k - 1) (Set.toList wasteCells)     :: UArray Int Int
      candidates = listArray (0, 2) ["Carrots", "Kiwis", "Grapes"]  :: Array  Int String
  rep t $ \_ -> do
    i   :: Int        <- input
    j   :: Int        <- input
    let !v = (i - 1) * m + (j - 1)
    if Set.member v wasteCells
      then output' ("Waste" :: String)
      else do
        let loop !n | n < k, v <= a ! n   = loop (n + 1)
                    | otherwise           = do
                        let idx = (v - n + 2) `mod` 3
                        output'  $ candidates ! idx
        loop 0

--------------------------------------------------
-- Imported C functions
--------------------------------------------------
#define BUFMAX                (100005)

type BString = BS.ByteString

foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i     :: CString -> Ptr Int   -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i64   :: CString -> Ptr Int64 -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_f     :: CString -> Ptr Float -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_s     :: CString -> CString   -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i    :: CString -> Int       -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i64  :: CString -> Int64     -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_d    :: CString -> Double    -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_s    :: CString -> CString   -> IO ()

fmt_i, fmt_i64, fmt_f, fmt_d, fmt_s :: CString
fmt_i   = unsafePerformIO $ newCString "%d"
fmt_i64 = unsafePerformIO $ newCString "%I64d"
fmt_f   = unsafePerformIO $ newCString "%f"
fmt_d   = unsafePerformIO $ newCString "%.16f"
fmt_s   = unsafePerformIO $ newCString "%s"
{-# NOINLINE fmt_i    #-}
{-# NOINLINE fmt_i64  #-}
{-# NOINLINE fmt_f    #-}
{-# NOINLINE fmt_d    #-}
{-# NOINLINE fmt_s    #-}

ptr_i   :: Ptr Int
ptr_i   = unsafePerformIO malloc
ptr_i64 :: Ptr Int64
ptr_i64 = unsafePerformIO malloc
ptr_f   :: Ptr Float
ptr_f   = unsafePerformIO malloc
ptr_d   :: Ptr Double
ptr_d   = unsafePerformIO malloc
ptr_s   :: CString
ptr_s   = unsafePerformIO $ mallocArray BUFMAX
{-# NOINLINE ptr_i    #-}
{-# NOINLINE ptr_i64  #-}
{-# NOINLINE ptr_f    #-}
{-# NOINLINE ptr_d    #-}
{-# NOINLINE ptr_s    #-}

class Input a           where
  input :: IO a

instance Input Int      where
  input = c_scanf_i fmt_i ptr_i >> peek ptr_i
instance Input Int64    where
  input = c_scanf_i64 fmt_i64 ptr_i64 >> peek ptr_i64
instance Input Integer  where
  input = toInteger <$> (input :: IO Int64)
instance Input Double   where
  input = c_scanf_f fmt_f ptr_f >> realToFrac <$> peek ptr_f
instance Input String   where
  input = c_scanf_s fmt_s ptr_s >> peekCString ptr_s
instance Input BString  where
  input = c_scanf_s fmt_s ptr_s >> BS.packCString ptr_s

class Output a          where
  output_   :: a -> IO ()
  output    :: a -> IO ()
  output    = (>> space  ) . output_
  output'   :: a -> IO ()
  output'   = (>> newline) . output_

instance Output Int     where
  output_   = c_printf_i fmt_i
instance Output Int64   where
  output_   = c_printf_i64 fmt_i64
instance Output Integer where
  output_   = output_ . show
instance Output Double  where
  output_   = c_printf_d fmt_d
instance Output String  where
  output_   = flip withCString (c_printf_s fmt_s)
instance Output BString where
  output_   = flip BS.useAsCString (c_printf_s fmt_s)

space   :: IO ()
space   = output_ (" "  :: String)

newline :: IO ()
newline = output_ ("\n" :: String)

for :: Int -> Int -> (Int -> IO ()) -> IO ()
for !begin !end k = loop begin
  where loop !i | i >= end  = return ()
                | otherwise = k i >> loop (i + 1)

rep :: Int -> (Int -> IO ()) -> IO ()
rep = for 0

{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, BangPatterns, PatternGuards, ViewPatterns, RecordWildCards, ForeignFunctionInterface, CPP, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ImplicitParams #-}
{-# OPTIONS_GHC -O2 -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-unused-imports #-}

import Control.Applicative
import Control.Monad
import Foreign
import Foreign.C
import Data.List
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as BS
-- import qualified Data.Map as Map
import qualified Data.Set as Set

main :: IO ()
main = do
  _   :: Int64        <- input
  m   :: Int64        <- input
  k   :: Int64        <- input
  t   :: Int64        <- input
  let checkWasteCells acc !i | i >= k     = return acc
                             | otherwise  = do
                                 a   :: Int64        <- input
                                 b   :: Int64        <- input
                                 checkWasteCells (Set.insert ((a - 1) * m + (b - 1)) acc) (i + 1)
  wasteCells <- checkWasteCells Set.empty 0
  let a          = listArray (0, k - 1) (Set.toList wasteCells)     :: UArray Int64 Int64
      candidates = listArray (0, 2) ["Carrots", "Kiwis", "Grapes"]  :: Array  Int64 String
  rep (fromIntegral t) $ \_ -> do
    i   :: Int64        <- input
    j   :: Int64        <- input
    let !v = (i - 1) * m + (j - 1)
    if Set.member v wasteCells
      then output' ("Waste" :: String)
      else do
        let loop !n | n < k, v <= a ! n   = loop (n + 1)
                    | otherwise           = do
                        let idx = (v - n + 2) `mod` 3
                        output'  $ candidates ! idx
        loop 0

--------------------------------------------------
-- Imported C functions
--------------------------------------------------
#define BUFMAX                (100005)

type BString = BS.ByteString

foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i     :: CString -> Ptr Int   -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i64   :: CString -> Ptr Int64 -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_f     :: CString -> Ptr Float -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_s     :: CString -> CString   -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i    :: CString -> Int       -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i64  :: CString -> Int64     -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_d    :: CString -> Double    -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_s    :: CString -> CString   -> IO ()

fmt_i, fmt_i64, fmt_f, fmt_d, fmt_s :: CString
fmt_i   = unsafePerformIO $ newCString "%d"
fmt_i64 = unsafePerformIO $ newCString "%I64d"
fmt_f   = unsafePerformIO $ newCString "%f"
fmt_d   = unsafePerformIO $ newCString "%.16f"
fmt_s   = unsafePerformIO $ newCString "%s"
{-# NOINLINE fmt_i    #-}
{-# NOINLINE fmt_i64  #-}
{-# NOINLINE fmt_f    #-}
{-# NOINLINE fmt_d    #-}
{-# NOINLINE fmt_s    #-}

ptr_i   :: Ptr Int
ptr_i   = unsafePerformIO malloc
ptr_i64 :: Ptr Int64
ptr_i64 = unsafePerformIO malloc
ptr_f   :: Ptr Float
ptr_f   = unsafePerformIO malloc
ptr_d   :: Ptr Double
ptr_d   = unsafePerformIO malloc
ptr_s   :: CString
ptr_s   = unsafePerformIO $ mallocArray BUFMAX
{-# NOINLINE ptr_i    #-}
{-# NOINLINE ptr_i64  #-}
{-# NOINLINE ptr_f    #-}
{-# NOINLINE ptr_d    #-}
{-# NOINLINE ptr_s    #-}

class Input a           where
  input :: IO a

instance Input Int      where
  input = c_scanf_i fmt_i ptr_i >> peek ptr_i
instance Input Int64    where
  input = c_scanf_i64 fmt_i64 ptr_i64 >> peek ptr_i64
instance Input Integer  where
  input = toInteger <$> (input :: IO Int64)
instance Input Double   where
  input = c_scanf_f fmt_f ptr_f >> realToFrac <$> peek ptr_f
instance Input String   where
  input = c_scanf_s fmt_s ptr_s >> peekCString ptr_s
instance Input BString  where
  input = c_scanf_s fmt_s ptr_s >> BS.packCString ptr_s

class Output a          where
  output_   :: a -> IO ()
  output    :: a -> IO ()
  output    = (>> space  ) . output_
  output'   :: a -> IO ()
  output'   = (>> newline) . output_

instance Output Int     where
  output_   = c_printf_i fmt_i
instance Output Int64   where
  output_   = c_printf_i64 fmt_i64
instance Output Integer where
  output_   = output_ . show
instance Output Double  where
  output_   = c_printf_d fmt_d
instance Output String  where
  output_   = flip withCString (c_printf_s fmt_s)
instance Output BString where
  output_   = flip BS.useAsCString (c_printf_s fmt_s)

space   :: IO ()
space   = output_ (" "  :: String)

newline :: IO ()
newline = output_ ("\n" :: String)

for :: Int -> Int -> (Int -> IO ()) -> IO ()
for !begin !end k = loop begin
  where loop !i | i >= end  = return ()
                | otherwise = k i >> loop (i + 1)

rep :: Int -> (Int -> IO ()) -> IO ()
rep = for 0


{-- This code was written by
Russell Emerine - linguist,
mathematician, coder,
musician, and metalhead. -}
import Control.Monad
import Data.Bool
import Data.List

main = getLine >>= flip replicateM_ test . read

test = do
    getLine
    as <- map read . words <$> getLine
    let ok = elem 1 (zipWith subtract <*> tail $ sort as) || even (length $ filter even as)
    putStrLn $ bool "NO" "YES" ok

import Control.Monad
import Data.List

data Answer = YES | NO deriving (Show)
type Test = [Int]

getTests :: Int -> IO [Test]
getTests n = replicateM n getTest

getTest :: IO Test
getTest = do
    _ <- getLine
    list <- getLine
    return $ parseInput list

parseInput :: String -> Test
parseInput list = map read (words list)

findAnswer :: [Test] -> [Answer]
findAnswer [] = []
findAnswer (first:rest) = (if (evens `mod` 2) + (odds `mod` 2) == 1
                         then NO
                         else if evens `mod` 2 == 0
                              then YES
                              else if areNeighbours $ sort first
                                   then YES
                                   else NO) : findAnswer rest
    where evens = length $ filter (\x -> x `mod` 2 == 0) first
          odds = (length first) - evens

areNeighbours :: Test -> Bool
areNeighbours [x] = False
areNeighbours (x:y:rest) = if y == x+1
                           then True
                           else areNeighbours (y:rest)

main :: IO ()
main = do
    count <- getLine
    tests <- getTests $ read count
    mapM_ print (findAnswer tests)

import           Data.List
import           Control.Monad

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

solve :: IO ()
solve = do
    _  <- getLine
    as <- map read . words <$> getLine
    let (evens, odds) = partition even as
    putStrLn $ case mod (length evens) 2 of
        0 -> "YES"
        1 -> if or [ abs (x - y) == 1 | x <- evens, y <- odds ]
            then "YES"
            else "NO"

import Control.Monad (replicateM_)
import qualified Data.Set as Set

readLine :: IO [Integer]
readLine = getLine >> (map read) . words <$> getLine

isPartitionPossible xs =
    if numEven == 0 || numOdd == 0 || even numEven then "YES"
    else if any (\x -> Set.member (x + 1) evenSet || Set.member (x - 1) evenSet) odds then "YES"
    else "NO"
    where
        evens = filter even xs
        odds = filter odd xs
        numEven = length evens
        numOdd = length odds
        evenSet = Set.fromList evens

main =
    read <$> getLine >>= \t ->
    replicateM_ t (isPartitionPossible <$> readLine >>= putStrLn)

import Control.Monad ( replicateM_ )
import qualified Data.Set as Set

readInput = getLine >> (map read . words <$> getLine)

similarPairs :: [Int] -> String
similarPairs s = let odds = length (filter odd s) in
    if even odds then "YES"
    else if any (flip Set.member set . succ) s then "YES"
    else "NO"
    where set = Set.fromList s

main = do
    t <- read <$> getLine
    replicateM_ t (similarPairs <$> readInput >>= putStrLn)

--- frederick99, 6/2020
--- https://codeforces.com/contest/1360/problem/C

import           Control.Monad ( replicateM_ )
import qualified Data.Set as Set

similarPairs :: [Int] -> String
similarPairs s = let odds = length (filter odd s) in
    if even odds || any (seen . succ) s
        then "YES"
        else "NO"
    where seen = (`Set.member` Set.fromList s)

readInput :: IO [Int]
readInput = getLine >> map read . words <$> getLine

main :: IO ()
main = do
    t <- read <$> getLine
    replicateM_ t (similarPairs <$> readInput >>= putStrLn)

import Data.List (sort)
import Data.Traversable (for)

diff1 :: [Int] -> Bool
diff1 li = let  sli = sort li  in  elem 1 $ zipWith (-) (tail sli) sli

countEven :: [Int] -> Int
countEven = length . filter ((== 0) . (`mod` 2))

main :: IO ()
main = do
  nCases <- fmap read getLine :: IO Int
  _ <- for [1..nCases] $ \_ -> do
    n <- fmap read getLine :: IO Int
    a <- fmap (map read . words) getLine :: IO [Int]
    putStrLn $ case () of
      _ | odd n -> "NO"
      _ | even (countEven a) -> "YES"
      _ | diff1 a -> "YES"
      _ -> "NO"
  return ()

{-- This code was written by
Russell Emerine - linguist,
mathematician, coder,
musician, and metalhead. -}
import Control.Monad
import Data.Bool
import Data.List

main = getLine >>= flip replicateM_ test . read

test = do
    getLine
    as <- map read . words <$> getLine
    let ok = elem 1 (zipWith subtract <*> tail $ sort as) || even (length $ filter even as)
    print $ bool "NO" "YES" ok

import Control.Monad (replicateM_)
import qualified Data.Set as Set

readLine :: IO [Integer]
readLine = getLine >> (map read) . words <$> getLine

isPartitionPossible xs =
    if numEven == 0 || numOdd == 0 || even numEven then "YES"
    else if any (\x -> Set.member (x + 1) evenSet || Set.member (x - 1) evenSet) odds then "YES"
    else "NO"
    where
        evens = filter even xs
        odds = filter odd xs
        numEven = length evens
        numOdd = length odds
        evenSet = Set.fromList evens

main =
    read <$> getLine >>= \t ->
    replicateM_ t (isPartitionPossible <$> readLine >>= print)