-- 2019-11-24 05:02:38.537124654 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:47:40.593640185 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-20 21:17:08.568559806 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051817 -> iF ((n_6989586621679051817 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:04:24.247100453 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-14 21:34:13.653101282 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679121131 -> iF ((n_6989586621679121131 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:25:35.391704187 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:45:57.671564784 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:48:17.054512803 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:23:34.78482098 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:10:01.201803523 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-20 21:04:10.502421734 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050267 -> iF ((n_6989586621679050267 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

main = interact $ merge . flip take (cycle ["hate","love"]) . read
merge [f] = "I " ++ f ++ " it"
merge (f:fs) = "I " ++ f ++ " that " ++ merge fs

import System.IO
import Control.Monad
import Data.List

glwr = fmap (map read . words) getLine

main = do
  hSetBuffering stdout NoBuffering
  solve

solve :: IO ()
solve = do
  n:_ <- glwr

  putStrLn $ hulk n

hulk :: Int -> String
hulk n =  [1..n] >>= ko n

ko n i
  = "I "
  ++ ["love ", "hate "] !! fromEnum (odd i)
  ++ ["that ", "it "] !! fromEnum (n == i)

main = getLine >>= putStrLn . solve 0 . read

solve 0 n = "I hate " ++ solve 1 n
solve _ 1 = "it"
solve m n = if m `mod` 2 == 0
            then "that I hate " ++ solve (m + 1) (n - 1)
            else "that I love " ++ solve (m + 1) (n - 1)

module Main where
  import Data.List

  hateLove :: Integer -> String
  hateLove n
    | n `mod` 2 == 0 = "hate"
    | otherwise = "love"

  partialSolver :: Integer -> Integer -> [String] -> [String]
  partialSolver n i acc
    | n == i = acc
    | otherwise = partialSolver n (i + 1) $ (hateLove i):acc

  addIt :: String -> String
  addIt x = "I " ++ x ++ " it"

  addThat :: String -> String
  addThat x = "I " ++ x ++ " that"

  stringify :: [String] -> [String]
  stringify xs =
    let thatTail = addThat `map` (tail xs)
        itHead = addIt $ head xs
        in reverse $ itHead : thatTail

  solutionSolver :: Integer -> String
  solutionSolver n = intercalate " " $ stringify $ partialSolver n 0 []

  main :: IO ()
  main = do
    n <- getLine
    let i = read n :: Integer
    putStrLn $ solutionSolver i

-- Vicfred
-- https://codeforces.com/problemset/problem/705/A

hate :: Int -> String
hate 1 = "I hate it"
hate n = "I hate that " ++ love (n-1)

love :: Int -> String
love 1 = "I love it"
love n = "I love that " ++ hate (n-1)

main :: IO ()
main = readLn >>= putStrLn . hate

printer :: Int -> Int -> String
printer x y =
    if x == 1 then if y == 0 then "I hate it" else "I love it"
    else if y == 0 then "I hate that " ++ printer (x - 1) 1
    else "I love that " ++ printer (x - 1) 0

main = do
    xx <- getLine
    let x = read xx :: Int
    putStrLn (printer x 0)

main = do
    n <- readLn
    let talk 0 _ = " it"
	talk n love
	  | love	= " that I love" ++ talk (n-1) False
	  | otherwise	= " that I hate" ++ talk (n-1) True
    putStrLn $ "I hate"++talk (n-1) True

main :: IO ()
main = readLn >>= \n -> putStrLn $ addHateOrLove 1 n ""

addHateOrLove :: Int -> Int -> String -> String
addHateOrLove _ 0 _  = "it"
addHateOrLove c n xs
  | odd c     = "I hate " ++ xs ++ (addHateOrLove (c+1) (n-1) xs)
  | otherwise = "I love " ++ xs ++ (addHateOrLove (c+1) (n-1) xs)
  where
    xs = if n == 1 then "" else "that "

solve n = take (n+1) $ iterate (\x -> if (snd x) == n then (if (snd x) `mod` 2 == 1 then ("I hate it", (snd x)+1) else ("I love it", (snd x)+1))
                               else (if (snd x) `mod` 2 == 1 then ("I hate that ", (snd x)+1) else ("I love that ", (snd x)+1))
                               ) ("I hate it ", 1)
main = do
    line <- getLine
    let n = read line::Int in putStrLn $ concat $ map (fst) $ drop 1 $ solve n

main = do
 n <- getLine
 mapM_ putStr $ (take.read $ n) $ iterate (\str -> if str == "that I love " then "that I hate " else "that I love ") "I hate "
 putStr "it"

import Data.List
import System.IO

parseLine :: IO [String]
parseLine = fmap words getLine

parseInt :: IO [Int]
parseInt = fmap (map read . words) getLine

parseDouble :: IO [Double]
parseDouble = fmap (map read . words) getLine

solve :: Int -> Bool -> String
solve n isHate = if (n == 1) then (if isHate then "I hate it" else "I love it")
                 else (if isHate then "I hate that " else "I love that ") ++  (solve (n - 1) (not isHate))

main :: IO ()
main = do
  [n] <- parseInt

  putStrLn $ solve n True

solve :: Int -> String
solve x = solve' 1
    where
        start a = if a `mod` 2 == 0 then "I love " else "I hate "
        end a   = if a == x then "it " else "that "
        solve' a = if a > x then ""
            else start a ++ end a ++ solve' (a + 1)

main :: IO ()
main = putStrLn =<< solve . (read :: String -> Int) <$> getLine

main = do
    ln <- getLine
    x <- return $ (read ln :: Int) - 1
    putStrLn $ "I hate " ++ concat [ "that I " ++ (if u `mod` 2 == 0 then "hate " else "love ") | u <- [1..x] ] ++ "it"

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

type I = Int

main :: IO ()
main = do
  n <- readi <$> getLine
  putStrLn $ solve n

solve :: Int -> String
solve n = intercalate " that " (map (\x -> if odd x then "I hate" else "I love") [1..n]) ++ " it"

--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

readi :: String -> I
readi = read

toTuple :: [a] -> (a, a)
toTuple [x, y] = (x, y)

toTriple :: [a] -> (a, a, a)
toTriple [x, y, z] = (x, y, z)

main = do
    n <- getLine
    putStrLn . g . stoi . words $ n

stoi :: [[Char]] -> [Int]
stoi []     = []
stoi (n:ns) = (read n::Int) : stoi ns

g :: [Int] -> [Char]
g (x:_)
    | x >= 1 = "I hate" ++ foo (x-1)

bar :: Int -> [Char]
bar n
    | n == 0    = " it"
    | otherwise = " that I hate" ++ foo (n-1)

foo :: Int -> [Char]
foo n
    | n == 0    = " it"
    | otherwise = " that I love" ++ bar (n-1)

solve :: Bool -> Int -> String
solve True  1 = "I hate it"
solve False 1 = "I love it"
solve True  n = "I hate that " ++ solve False (n - 1)
solve False n = "I love that " ++ solve True  (n - 1)
main = putStrLn . solve True . read =<< getLine

--ghc 7.10

data Feel = Love | Hate deriving (Eq)

listFeeling :: Int -> Feel -> [String]
listFeeling 1 Love = ["I love it"]
listFeeling 1 Hate = ["I hate it"]
listFeeling n Love = "I love that ":listFeeling (n-1) Hate
listFeeling n Hate = "I hate that ":listFeeling (n-1) Love

hulkFeeling :: Int -> String
hulkFeeling n = concat $ listFeeling n Hate

main = do
    n <- getLine
    putStrLn . hulkFeeling . read $ n

-- Hulk -> CodeForces

phrases :: Int -> [String]
phrases x = if x`mod`2==0
  then ["hate ", "love "]
  else ["love ", "hate "]

hulkSpeak :: [String] -> Int -> String
hulkSpeak ps 0 = "it"
hulkSpeak ps x = "I " ++ phrase ++ hulkSpeak ps (x-1)
  where
    phrase =
      if x > 1
        then ps !! (x`mod`2) ++ "that "
        else ps !! (x`mod`2)

main = do
  x <- readLn :: IO Int
  let ps = phrases x
  putStrLn $ hulkSpeak ps x

phrases :: [String]
phrases = ["hate ", "love "]

hulkSpeak :: Int -> Int -> String
hulkSpeak x y =
  if x == y
    then "it"
    else "I " ++ phrase ++ hulkSpeak (x+1) y
      where
        phrase = if x /= (y-1)
          then phrases !! (x`mod`2) ++ "that "
          else phrases !! (x`mod`2)

main = do
  x <- readLn :: IO Int
  putStrLn $ hulkSpeak 0 x

import Data.List

process :: Int -> String
process source
    | mod source 2 == 1 = "I hate"
    | mod source 2 == 0 = "I love"

main :: IO ()
main = do
  text <- getLine
  let count = read text
  let result = intercalate " that " $ map process [1..count]
  putStrLn (result ++ " it")

import Data.List (intersperse)

feelings :: Int -> String
feelings n = (concat
             $ intersperse " that "
             $ take n
             $ map (\i -> if i `mod` 2 == 0 then "I love" else "I hate") [1..]
             ) ++ " it"

main :: IO ()
main = do
    n <- read <$> getLine
    putStrLn $ feelings n

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

main= do
		c<-  read <$>  getLine::IO Int
	   	let d = intercalate " that " $ take c $ cycle ["I hate" , "I love"]
           	putStrLn $ d++ " it"

main = do
  m <- readLn
  putStrLn $ hulk m
hulk :: Int -> String
hulk m = (drop 5 (foldl (\x y -> x ++ "that " ++ y) [] took)) ++ "it"
  where took = take m (cycle ["I hate ", "I love "])

import Data.List
main = interact $ express . read

express n = (intercalate " that " feelings) ++ " it"
    where feelings = fmap (\i -> if odd i then "I hate" else "I love") [1..n]

import Data.List
main :: IO ()
main = do
        interact $ express . read

express :: Int -> String
express n = (intercalate " that " feelings) ++ " it"
    where feelings = fmap (\i -> if odd i then "I hate" else "I love") [1..n]

import Data.List
main = interact $ express . read
express n = intercalate " that " (take n $ cycle ["I hate",  "I love"]) ++ " it"

import Data.List

solve n = intercalate " that " (take n $ concat (replicate n ms)) ++ " it"
    where ms = ["I hate", "I love"]

main = do
    n <- readLn :: IO Int
    putStrLn $ solve n

import Control.Applicative
import Control.Monad
import Data.STRef
import GHC.Float.RealFracMethods
main :: IO ()
main = do
  n <- getLine
  mapM_ (\x -> putStr$x++" ")$mood (read n) False
  putStrLn ""

mood :: Int -> Bool -> [String]
mood 1 x = ["I", if x then "love" else "hate", "it"]
mood a x = ["I", if x then "love" else "hate", "that"]++ (mood (a-1)$not x)

import Data.Maybe
import Control.Monad
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8

getInt = read `fmap` getLine :: IO Int
getInts = (map (fst . fromJust . BS8.readInt) . BS8.words) `fmap` BS.getLine :: IO [Int]

getDouble = read `fmap` getLine :: IO Double
getDoubles = map fromIntegral `fmap` getInts :: IO [Double]

love = "that I love "
hate = "that I hate "

main = do
    n <- getInt
    if n == 1 then putStrLn "I hate it"
    else putStrLn ("I hate " ++ build n ++ "it")

build 1 = ""
build n = build (n-1) ++ (if n `mod` 2 == 0 then love else hate)

f 1 True = ["I love it"]
f 1 False = ["I hate it"]
f n True = "I love that":(f (n-1) False)
f n False = "I hate that":(f (n-1) True)
fn x = unwords (f x False)
main = do
    n <- getLine
    putStrLn (fn (read n))

main = do
  n <- getLine
  let f (x, y) = if (x > 0) then (if y then "I hate" else "I love") ++ (if (x > 1) then " that " else "") ++  f(x - 1, not y) else " it"
  putStrLn( f(read $ n, True) );

import Data.List

main = do
    n <- getLine
    let emotions = [if odd(i) then hate else love | i <- [1..(read n :: Int)]]
    putStrLn $ intercalate "that " emotions ++ "it"

hate :: String
hate = "I hate "

love :: String
love = "I love "

go :: (Integral x) => x -> String

go n
  | n == 1            = "I hate"
  | (n `mod` 2) == 1  = (go (n-1)) ++ " that I hate"
  | otherwise         = (go (n-1)) ++ " that I love"

main = do
  line <- getLine
  let n = read line :: Int
  putStrLn $ go n ++ " it"

main :: IO ()
main = do
  layer <- readLn
  putStrLn ( hulk layer )

hulk :: Int -> String
hulk x = (hulkLayer x) ++ " it"

hulkLayer :: Int -> String
hulkLayer 1 = "I hate"
hulkLayer x =
  (hulkLayer (x-1)) ++ " that I " ++ (feel x)

feel :: Int -> String
feel x = if odd x then "hate" else "love"

{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, BangPatterns #-}
{-# OPTIONS_GHC -O2 #-}

import Control.Applicative
import Control.Monad hiding ((<$!>))
import Control.Monad.ST.Safe
import Control.Monad.State hiding ((<$!>))
import Data.Array
-- import Data.Array.IArray
import Data.Array.IO.Safe
import Data.Array.MArray.Safe
import Data.Array.ST.Safe
-- import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy.Builder as BB
import Data.Char
import qualified Data.Foldable as F
import Data.Function
import Data.Graph
import Data.Int
import Data.List
import Data.List.Split
import Data.Maybe
import Data.Monoid
import Data.Ratio
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import Data.Set (Set)
import qualified Data.Set as Set
import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet
-- import Data.Tree
import Data.Tuple
import Data.Map (Map)
import qualified Data.Map as Map
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
-- import Debug.Trace
import System.IO

-- getInts = fmap (map read . words) getLine
getInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

main = do
  n <- readLn

  putStrLn $ unwords $ zipWith (++) (concat $ repeat ["I hate", "I love"]) (replicate (n-1) " that" ++ [" it"])

main = do
    n <- fmap read getLine :: IO Int
    putStrLn $ solve "hate" n

solve :: String -> Int -> String
solve s 1 = "I " ++ s ++ " it"
solve s n = "I " ++ s ++ " that " ++ solve (opp s) (n - 1)

opp :: String -> String
opp "hate" = "love"
opp _ = "hate"

{-# LANGUAGE BlockArguments #-}

import Control.Arrow

main = do { x <- getLine; (read >>> solve "I hate " 1 >>> putStrLn) x }

solve :: String -> Int -> Int -> String
solve s x y | x == y = s ++ "it"
            | mod x 2 == 0 = solve (s ++ "that I hate ") (x+1) y
            | mod x 2 == 1 = solve (s ++ "that I love ") (x+1) y

import Control.Applicative ((<$>))
import qualified Data.List as L

solve :: Int -> String
solve t = (L.intercalate " " seg) ++ " it"
  where
    seg     = foldl apd ["I hate"] [2..t]
    apd l n
      | even n    = l ++ ["that I love"]
      | otherwise = l ++ ["that I hate"]

main :: IO ()
main = do
  n <- read <$> getLine
  putStrLn (solve n)

import Data.List
import Data.Maybe
import Data.Char
import Data.Function
main=   readsolveprint
readsolveprint::IO()
readsolveprint =  interact $ unwords . solve.read.head. lines
solve :: Int->[String]
solve 1= ["I hate it"]
solve x =  (take (x-1) $  cycle ["I hate that", "I love that"])  ++ f where
  f=if x `mod` 2 /= 0 then ["I hate it"] else ["I love it"]

f n | n == 1 = "I hate it"
    | n == 2 = "I hate that I love it"
    | otherwise = "I hate that I love that " ++ f (n - 2)

main = getLine >>= (putStrLn . f . read . head . words)

import Control.Monad

main = getInt >>= putStrLn . parse

getInt::IO Int
getInt = liftM read getLine

parse::Int -> String
parse n = start ++ " it"
  where start = foldl concat "I hate" [2..n]
        concat str i
          | i `mod` 2 == 0 = str ++ " that I love"
          | otherwise = str ++ " that I hate"

import Text.Printf
import Data.List
import Data.Functor
import Prelude

readInt :: String -> Int
readInt = read

main :: IO ()
main = do
    n <- read <$> getLine
    putStrLn . (++ " it") . intercalate " that " . take n . cycle $ ["I hate", "I love"]

hate :: Int -> String
love :: Int -> String

hate 1 = "I hate it"
hate n = "I hate that " ++ love (n - 1)
love 1 = "I love it"
love n = "I love that " ++ hate (n - 1)

main :: IO()
main = readLn >>= putStrLn . hate

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

main=do
     n<-  read <$>  getLine::IO Int
     let x= intercalate "that" $ take n $ cycle [" I hate "," I love "]
     putStrLn $  tail $ x ++ "it"

-- 2019-11-24 20:43:35.642224548 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:06:47.459910813 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> iF (((== 0) . (`mod` 2)) (b - a)) (("I hate that " ++) c) (("I love that " ++) c))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

f 1 True = ["I love it"]
f 1 False = ["I Hate it"]
f n True = "I love that":(f (n-1) False)
f n False = "I hate that":(f (n-1) True)
fn x = unwords (f x False)
main = do
    n <- getLine
    putStrLn (fn (read n))

main = do
  n <- getLine
  let f (x, y) = if (x > 0) then (if y then "I hate" else "I love") ++ (if (x > 1) then " that " else "") ++  f(x - 1, not y) else " it"
  putStrLn( show $ f(read $ n, True) );

main :: IO ()
main = do
  layer <- readLn
  putStrLn ( hulk layer )

hulk :: Int -> String
hulk 1 = "I hate it"
hulk x = "I " ++ (if odd x then "hate" else "love") ++ " that " ++ ( hulk (x-1) )

{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, BangPatterns #-}
{-# OPTIONS_GHC -O2 #-}

import Control.Applicative
import Control.Monad hiding ((<$!>))
import Control.Monad.ST.Safe
import Control.Monad.State hiding ((<$!>))
import Data.Array
-- import Data.Array.IArray
import Data.Array.IO.Safe
import Data.Array.MArray.Safe
import Data.Array.ST.Safe
-- import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy.Builder as BB
import Data.Char
import qualified Data.Foldable as F
import Data.Function
import Data.Graph
import Data.Int
import Data.List
import Data.List.Split
import Data.Maybe
import Data.Monoid
import Data.Ratio
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import Data.Set (Set)
import qualified Data.Set as Set
import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet
-- import Data.Tree
import Data.Tuple
import Data.Map (Map)
import qualified Data.Map as Map
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
-- import Debug.Trace
import System.IO

-- getInts = fmap (map read . words) getLine
getInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

main = do
  n <- readLn

  putStrLn $ unwords $ take n $ concat $ repeat ["I hate it", "I love it"]

main = do
    n <- fmap read getLine :: IO Int
    putStrLn $ solve n

solve :: Int -> String
solve 1 = "I hate it"
solve n
    | odd n = "I hate that " ++ solve (n - 1)
    | otherwise = "I love that " ++ solve (n - 1)

{-# LANGUAGE BlockArguments #-}

import Control.Arrow

main = interact $
    lines >>> map (words >>> head >>> read >>> solve "I hate " 1 >>> show) >>> unlines

solve :: String -> Int -> Int -> String
solve s x y | x == y = s ++ "it"
            | mod x 2 == 0 = solve (s ++ "that I hate ") (x+1) y
            | mod x 2 == 1 = solve (s ++ "that I love ") (x+1) y

import Control.Applicative ((<$>))
import qualified Data.List as L

solve :: Int -> String
solve t = (L.intercalate " " seg) ++ " it"
  where
    seg     = foldl apd ["I hate"] [2..t]
    apd l n
      | even n    = l ++ ["that I love"]
      | otherwise = l ++ ["that I hate"]

main :: IO ()
main = do
  n <- read <$> getLine
  putStrLn . show $ solve n

f n | n == 1 = "I hate it"
    | n == 2 = "I hate that I love it"
    | otherwise = "I hate that I love that" ++ f (n - 2)

main = getLine >>= (putStrLn . f . read . head . words)

import Control.Monad

main = getInt >>= putStrLn . parse

getInt::IO Int
getInt = liftM read getLine

parse::Int -> String
parse n = start ++ " it"
  where start = foldr concat "I hate" [2..n]
        concat i str
          | n `mod` i == 0 = str ++ " that I love"
          | otherwise = str ++ " that I hate"

-- 2019-11-24 05:08:28.558047825 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:05:04.834635846 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-20 21:10:01.434033762 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051817 -> iF ((n_6989586621679051817 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051817 -> iF ((n_6989586621679051817 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:02:02.916891858 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-20 21:00:19.524922601 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050267 -> iF ((n_6989586621679050267 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679050267 -> iF ((n_6989586621679050267 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 21:05:42.017908118 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:56:37.495202571 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051926 -> iF ((n_6989586621679051926 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051926 -> iF ((n_6989586621679051926 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:46:45.870399585 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-20 21:21:13.324129861 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) "I hate it" (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) "I love it" (("I love that " ++) (iF (((== 0) . (`mod` 2)) b) c "I hate it"))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:14:36.021897447 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) "I hate it" (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) "I love it" (("I love that " ++) (iF (((== 0) . (`mod` 2)) b) c "I hate it"))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-20 21:14:27.575368867 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051817 -> iF ((n_6989586621679051817 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051817 -> iF ((n_6989586621679051817 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:30:29.193048129 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:04:12.95242109 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051927 -> iF ((n_6989586621679051927 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051927 -> iF ((n_6989586621679051927 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-14 22:05:11.902524768 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) "I hate it" (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) "I love it" (("I love that " ++) (iF (((== 0) . (`mod` 2)) b) c "I hate it"))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:59:56.006024558 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051926 -> iF ((n_6989586621679051926 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051926 -> iF ((n_6989586621679051926 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:24:17.263832218 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:45:08.962334117 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:12:41.454933138 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051904 -> iF ((n_6989586621679051904 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051904 -> iF ((n_6989586621679051904 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-14 21:46:04.815094948 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) "I hate it" (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) "I love it" (("I love that " ++) (iF (((== 0) . (`mod` 2)) b) c "I hate it"))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:22:07.985374006 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 05:03:33.935721791 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679050168 -> iF ((n_6989586621679050168 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:17:12.017523452 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051904 -> iF ((n_6989586621679051904 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051904 -> iF ((n_6989586621679051904 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:44:21.332259381 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:43:28.27093953 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:08:12.229883881 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051947 -> iF ((n_6989586621679051947 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051947 -> iF ((n_6989586621679051947 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-14 21:32:41.179068145 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679121131 -> iF ((n_6989586621679121131 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679121131 -> iF ((n_6989586621679121131 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:40:14.555540688 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:27:10.184609196 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:33:27.153758054 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (iF (((== 0) . (`mod` 2)) b) c (("I love that " ++) ((\n_6989586621679051903 -> iF ((n_6989586621679051903 `mod` 2) == 0) "I love it" "I hate it") b))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 19:49:16.331063502 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679050238 -> iF ((n_6989586621679050238 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- 2019-11-24 20:53:48.546217396 UTC
import Data.Maybe
import Control.Monad
import Text.Read
nat_para :: Integral i => i -> a -> (i -> a -> a) -> a
nat_para i x f = np (abs i)
             where np 0 = x
                   np i = let i' = i - 1
                           in f i' (np i')
hd :: [a] -> a
hd ([]) = error "empty head"
hd (a : as) = a
tl = drop 1
nat_cata :: Integral i => i -> a -> (a -> a) -> a
nat_cata i x f = nc (abs i)
             where nc 0 = x
                   nc i = f (nc (i - 1))
iF :: Bool -> a -> a -> a
iF (True) t f = t
iF (False) t f = f
list_para :: [b] -> a -> (b -> [b] -> a -> a) -> a
list_para ([]) x f = x
list_para (y : ys) x f = f y ys (list_para ys x f)
magiciF :: Bool -> String
magiciF b = if b then "EASY" else "HARD"
uncurry' = id
parser :: String -> Int
parser = read
solve = \a -> nat_para (flip (-) 1 a) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a) (\b c -> ("I hate that " ++) (nat_para b c (\_ _ -> ("I love that " ++) ((\n_6989586621679051752 -> iF ((n_6989586621679051752 `mod` 2) == 0) "I love it" "I hate it") a))))
main = getContents >>= (\c -> putStrLn (uncurry' solve (parser c)))

-- Vicfred
-- https://codeforces.com/problemset/problem/705/A

hate :: Int -> String
hate 1 = "I hate it"
hate n = "I hate that " ++ love (n-1)

love :: Int -> String
love 1 = "I love it"
love n = "I love it that " ++ hate (n-1)

main :: IO ()
main = readLn >>= putStrLn . hate

main = do
    x <- getLine
    if x == "1" then putStrLn "I hate it"
    else if x == "2" then putStrLn "I hate that I love it"
    else putStrLn "I hate that I love that I hate it"

main = do
 n <- getLine
 mapM_ putStr $ (take.read $ n) $ iterate (\str -> if str == "I love that " then "I hate that " else "I love that ") "I hate that "

main = do
 n <- getLine
 mapM_ putStr $ (take.read $ n) $ iterate (\str -> if str == "I hate " then "that I love " else "that I hate ") "I hate "
 putStr "it"

import Data.List
import System.IO

parseLine :: IO [String]
parseLine = fmap words getLine

parseInt :: IO [Int]
parseInt = fmap (map read . words) getLine

parseDouble :: IO [Double]
parseDouble = fmap (map read . words) getLine

solve :: Int -> Bool -> String
solve n isHate = if (n == 1) then (if isHate then "I hate it" else "I love it")
                 else (if isHate then "I hate that " else "I love that") ++  (solve (n - 1) (not isHate))

main :: IO ()
main = do
  [n] <- parseInt

  putStrLn $ solve n True

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

type I = Int

main :: IO ()
main = do
  n <- readi <$> getLine
  putStrLn $ solve n

solve :: Int -> String
solve n = intercalate " that " (map (\x -> if odd x then "I hate" else "I love") $ reverse [1..n]) ++ " it"

--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --

readi :: String -> I
readi = read

toTuple :: [a] -> (a, a)
toTuple [x, y] = (x, y)

toTriple :: [a] -> (a, a, a)
toTriple [x, y, z] = (x, y, z)

phrases :: [String]
phrases = ["love", "hate"]

hulkSpeak :: Int -> String
hulkSpeak 0 = " it"
hulkSpeak x = " that I " ++ (phrases !! (x`mod`2)) ++ hulkSpeak (x-1)

main = do
  x <- readLn :: IO Int
  putStrLn ("I hate" ++ hulkSpeak (x-1))

phrases :: [String]
phrases = ["hate ", "love "]

hulkSpeak :: Int -> String
hulkSpeak 0 = "it"
hulkSpeak x = "I " ++ phrase ++ hulkSpeak (x-1)
  where
    phrase = if x > 1
      then phrases !! (x`mod`2) ++ "that "
      else phrases !! (x`mod`2)

main = do
  x <- readLn :: IO Int
  putStrLn $ hulkSpeak x

solve :: Int -> String
solve 1 = "I hate it"
solve x
    | even x = "I love that " ++ solve (x - 1)
    | otherwise = "I hate that " ++ solve (x - 1)

main :: IO ()
main = putStrLn =<< solve . (read :: String -> Int) <$> getLine

process :: Int -> String
process source
    | mod source 2 == 1 = "I hate it"
    | mod source 2 == 0 = "I love it"

main :: IO ()
main = do
  text <- getLine
  let count = read text
  let result = unwords $ map process [1..count]
  putStrLn (show result)

process :: Int -> String
process source
    | mod source 2 == 1 = "I hate it"
    | mod source 2 == 0 = "I love it"

main :: IO ()
main = do
  text <- getLine
  let count = read text
  let result = unwords $ map process [1..count]
  putStrLn result

import Data.List
main :: IO ()
main = do
        interact $ show . express . read

express :: Int -> String
express n = (intercalate " that " feelings) ++ " it"
    where feelings = fmap (\i -> if odd i then "I hate" else "I love") [1..n]


import Data.List

-- some readers
readInt :: String -> Int
readInt = read

readLL :: String -> [Int]
readLL = (map read) . words

-- main function
main = do
    n <- getLine >>= return . readInt
    xs <- getLine >>= return . readLL
    printRes $ solve n xs where

    solve n xs = case findIndex (\(x, y) -> y>x) pairs of
        Nothing -> [0, 0]
        Just b  -> case findIndex (\(x, y) -> y<x) (reverse pairs) of
            Nothing -> [0, 0]
            Just e  -> if (take b xs ++ reverse (drop b (take (n-e) xs)) ++ drop (n-e) xs) == [1..n]
                then [(b+1), (n-e)]
                else [0, 0]
        where
            pairs = zip [1..n] xs
    printRes [a, b] = putStrLn $ show a ++ " " ++ show b

main = do interact (unwords . map show . gao . map read . tail . words)

gao a = if not (null b) && b == r c then [head c, last c] else [0, 0] where
	r = reverse
	f = r . dropWhile (uncurry (==))
	(b, c) = unzip $ f . f $ zip a [1 ..]

prob :: [Int] -> Int -> Maybe (Int, Int)
prob [] _ = Nothing
prob (x:xs) n
	| x == n = prob xs $ n+1
	| x < n = Nothing
	| otherwise = Just (n, x)

maybe_reverse :: [Int] -> Maybe (Int, Int) -> [Int]
maybe_reverse xs Nothing = []
maybe_reverse xs (Just (x, y)) =
	take (x-1) xs ++ (reverse $ take (y-x+1) $ drop (x-1) xs) ++ (drop y xs)

maybe_puts :: Maybe String -> IO ()
maybe_puts Nothing = return ()
maybe_puts (Just str) = putStrLn str

main = do
	n <- getLine >>= return . read :: IO Int
	lst <- getLine >>= return . (map read) . words :: IO [Int]
	if maybe_reverse lst (prob lst 1) == [1..n]
		then maybe_puts $ prob lst 1 >>= \(x, y) -> Just $ (show x) ++ " " ++ (show y)
		else putStrLn "0 0"

import Control.Applicative
import Text.Printf
import Data.Maybe
import Data.List

solve :: [Int] -> Maybe (Int, Int)
solve arr | (not$ null ix) && (and$ zipWith (<) arr' (tail arr')) = Just(l+1, r+1)
          | otherwise = Nothing
  where
    gs = zipWith (<) arr (tail arr)
    ix = elemIndices False gs
    l = head ix
    r = (last ix)+1
    arr' = (take l arr) ++
           (reverse$ take (r-l+1) $ drop l arr) ++
           (drop (r+1) arr)

main = do
  getLine
  arr <- (map read . words) <$> getLine
  case solve arr of
    Just (l, r) -> putStrLn (printf "%d %d" l r)
    Nothing -> putStrLn "0 0"

import Maybe (fromMaybe)
import Monad (liftM)

solve :: [(Int, Int)] -> Maybe (Int, Int)
solve []  =  Nothing
solve ((n, x):xs)
  | n == x  =  solve xs
  | otherwise  =  solve2 (n,x) xs
  where
    solve2 _ []  =  Nothing
    solve2 (n,x) ((m,y):ys)
      | n + x /= m + y  =  Nothing
      | y == n  =  solve3 (n, m) ys
      | otherwise  =  solve2 (n, x) ys
    solve3 (n, m) []  =  Just (n, m)
    solve3 (n, m) ((k, z):zs)
      | k == z  =  solve3 (n, m) zs
      | otherwise  =  Nothing

main :: IO ()
main  =  do
    getLine
    xs  <-  liftM (map read . words) getLine
    let (a, b)  =  fromMaybe (0, 0) $ solve $ zip [1..] xs
    putStrLn $ show a ++ " " ++ show b

solve (n:xs) = (show a) ++ " " ++ (show b)
  where (a, b) = if origin == reverse rev && (not $ null origin) then
                   (head origin, last origin)
                 else
                   (0, 0)
        (origin, rev) = unzip $ filter (\(x, y) -> x /= y) $ zip [1..n] xs

main = interact (solve.map read.words)

import Prelude
import Data.Char
import Data.List
import Data.Functor

main = interact q

q = func . tail . map read . words

func::[Int]->String
func x = case solve x of
           Just (a, b) -> (show a) ++ " " ++ (show b)
           Nothing-> "Error occurred"

fileInteract func inf ouf = do file <- readFile inf
                               writeFile ouf (func file)

toInt::String->Int
toInt = read

asInteger::String->Integer
asInteger = read

toString::Int->String
toString = show

reverseTuple::(a,b)->(b,a)
reverseTuple (a,b) = (b,a)

isVailed::String->Bool
isVailed "" = False
isVailed "0" = True
isVailed ('0':_) = False
isVailed _ = True

solve::[Int]->Maybe (Int, Int)
solve [] = Just (0, 0)
solve a  = Just $ s' 0 a

s'::Int->[Int]->(Int, Int)
s' _ []     = (0, 0)
s' n (x:xs) | n + 1 == x = s' x xs
            | otherwise  = if left == -1 then (0,0)
                           else (left, x)
            where
              left = s'' x xs

s''::Int->[Int]->Int
s'' n []                     = n
s'' n (x:xs) | n - 1 == x    = s'' x xs
             | sorted (x:xs) = n
             | otherwise     = -1

sorted::[Int]->Bool
sorted []     = True
sorted (a:[]) = True
sorted (a:b:xs) | a + 1 == b = sorted (b:xs)
                | otherwise  = False

main = do getLine
          a <- fmap (map read . words) getLine
          let n = length a
              lst = [i | i<-[0..n-1], a!!i /= i+1]
              (i,j) = (head lst, last lst)
              swap i j a = take i a ++ reverse(take (j-i+1) (drop i a)) ++ drop (j+1) a
          if null lst
             then putStrLn "0 0"
             else if swap i j a == [1..n]
                     then putStrLn $ show (i+1) ++ " " ++ show (j+1)
                     else putStrLn "0 0"

main = do interact (unwords . map show . gao . map read . tail . words)

gao a = if not (null b) && b == r c then [head b, head c] else [0, 0] where
	r = reverse
	f = r . dropWhile (uncurry (==))
	(b, c) = unzip $ f . f $ zip a [1 ..]

import Control.Applicative
import Text.Printf
import Data.Maybe
import Data.List

solve :: [Int] -> Maybe (Int, Int)
solve arr | and$ take (r-l+1)$ drop l gs  = Nothing
          | otherwise = Just (l, r)
  where
    gs = zipWith (<) arr (tail arr)
    ix = elemIndices False gs
    nd = length$ group gs
    l = head ix
    r = (last ix)+1

main = do
  getLine
  arr <- (map read . words) <$> getLine
  case solve arr of
    Just (l, r) -> putStrLn (printf "%d %d" l r)
    Nothing -> putStrLn "0 0"

import Prelude
import Data.Char
import Data.List
import Data.Functor

main = interact q

q = func . tail . map read . words

func::[Int]->String
func x = case solve x of
           Just (a, b) -> (show a) ++ " " ++ (show b)
           Nothing-> "Error occurred"

fileInteract func inf ouf = do file <- readFile inf
                               writeFile ouf (func file)

toInt::String->Int
toInt = read

asInteger::String->Integer
asInteger = read

toString::Int->String
toString = show

reverseTuple::(a,b)->(b,a)
reverseTuple (a,b) = (b,a)

isVailed::String->Bool
isVailed "" = False
isVailed "0" = True
isVailed ('0':_) = False
isVailed _ = True

solve::[Int]->Maybe (Int, Int)
solve [] = Just (0, 0)
solve a  = Just $ s' 0 a

s'::Int->[Int]->(Int, Int)
s' _ []     = (0, 0)
s' n (x:xs) | n + 1 == x = s' x xs
            | otherwise  = if left == -1 then (0,0)
                           else (left, n)
            where
              left = s'' x xs

s''::Int->[Int]->Int
s'' n []                     = n
s'' n (x:xs) | n - 1 == x    = s'' x xs
             | sorted (x:xs) = n
             | otherwise     = -1

sorted::[Int]->Bool
sorted []     = True
sorted (a:[]) = True
sorted (a:b:xs) | a + 1 == b = sorted (b:xs)
                | otherwise  = False


convert x (y:"") = y:""

convert True s@(a1:a2:"") = if a1 == a2 && (a1 == 'a' || a1 == 'e' || a1 == 'i' || a1 == 'o' || a1 == 'u' || a1 == 'y') then a1:"" else s
convert False s@(a1:a2:"") = if a1 /= a2 || (a1 == 'o' || a1 == 'e') || (not (a1 == 'a' || a1 == 'e' || a1 == 'i' || a1 == 'o' || a1 == 'u' || a1 == 'y')) then s else a1:""

convert True (a:b:c) = if a == b && (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' || a == 'y') then convert True (b:c) else a:(convert False (b:c))
convert False s@(a:b:c:d)
    | a == b && a == c && (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' || a == 'y') = convert True (b:c:d)
    | a == b && a /= c && (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' || a == 'y') = if (a == 'o' || a == 'e') then a:b:(convert False (c:d)) else a:(convert False (c:d))
--    | otherwise = traceShow s $ undefined

convert x (y:ys) = y:(convert False ys)

solve n s = convert False s

main = do
    n <- getLine
    s <- getLine
    putStrLn $ solve (read n :: Int) s

--ghc 7.10

import Data.List

t ['e', 'e'] = "ee"
t ['o', 'o'] = "oo"
t ('u':_) = ['u']
t ('y':_) = ['y']
t ('a':_) = ['a']
t ('i':_) = ['i']
t ('e':_) = ['e']
t ('o':_) = ['o']
t x = x

transform :: String -> String
transform s = concat (map t (group  s))

main = do
  n <- getLine
  s <- getLine
  --print (group s)
  putStrLn $ transform s

import Data.List
main = interact $ process . last . lines

process x = concat$ map test $ group x

test x
  | notElem (head x) "aeiouy" = x
  | (head x == 'o') && (length x < 3) = x
  | (head x == 'e') && (length x < 3) = x
  | otherwise = [head x]

convert True (a:b:c) = if a == b then convert True (b:c) else convert False (a:b:c)
convert False (a:b:c:d) = if a == b && a == c then convert True (b:c:d) else a:(convert False (b:c:d))
convert x s = s

solve n s = convert False s

main = do
    n <- getLine
    s <- getLine
    putStrLn $ solve (read n :: Int) s

convert x (y:"") = y:""

convert True s@(a1:a2:"") = if a1 == a2 then a1:"" else s
convert False s@(a1:a2:"") = if a1 /= a2 || (a1 == 'o' || a1 == 'e') then s else a1:""

convert True (a:b:c) = if a == b then convert True (b:c) else a:(convert False (b:c))
convert False s@(a:b:c:d)
    | a == b && a == c = convert True (b:c:d)
    | a == b && a /= c = if (a == 'o' || a == 'e') then a:b:(convert False (c:d)) else a:(convert False (c:d))
--    | otherwise = traceShow s $ undefined

convert x (y:ys) = y:(convert False ys)

solve n s = convert False s

main = do
    n <- getLine
    s <- getLine
    putStrLn $ solve (read n :: Int) s


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

getElem :: Read t => IO t
getElem = getLine >>= return . read

getElems :: Read t => IO [t]
getElems = getLine >>= return . map read . words

main = do
    t <- getElem
    replicateM_ t $ do
        n:k:_ <- getElems :: IO [Int]
        if even n || k == 1 then do
            let odds = [1,3..n*k]
            let evens = [2,4..n*k]
            putStrLn "YES"
            showAns odds evens k
        else do
            putStrLn "NO"
            return ()
    where
        showAns :: [Int] -> [Int] -> Int -> IO ()
        showAns [] _ _ = return ()
        showAns this that k = do
            let (this1, this2) = splitAt k this
            putStrLn $ this1 >>= (' ' :) . show
            showAns that this2 k

{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BlockArguments #-}
import Control.Monad
solve :: Int -> Int -> Maybe [[Int]]
solve n k
  | k == 1 = Just [[i] | i <- [1..n]]
  | odd n = Nothing
  | otherwise = Just do
    i <- [0..n-1]
    return $ do
      let !(i', p) = divMod i 2
      j <- [0..k-1]
      return $! 2 * (i' * k + j) + p + 1

main :: IO ()
main = do
  t <- readLn
  replicateM_ t $ do
    [n, k] <- map read . words <$> getLine
    case solve n k of
      Nothing -> putStrLn "NO"
      Just xss -> do
        putStrLn "YES"
        forM_ xss $ \xs -> putStrLn $ unwords $ map show xs

import qualified Data.ByteString.Lazy.Char8 as P
import Data.ByteString.Builder
import qualified Data.ByteString.Builder.Prim as Prim
import System.IO
import Control.Monad.Trans.State
import Data.Maybe

--import Data.ByteString.Builder.Extra (flush) -- for interactive problems
import Control.Monad
--import Data.List
--import Data.Array.Unboxed

solve :: Int -> Int -> Maybe [[Int]]
solve n 1 = Just $ map pure [1 .. n]
solve n k = if  odd n
  then  Nothing
  else  Just $ do
  start <- [0, 2 .. n - 1]
  [take k [start*k + 1, start*k + 3 ..], take k [start*k + 2, start*k + 4 ..]]

mainFun :: SP Builder
mainFun = do
  t <- getInt
  fmap mconcat $ replicateM t $ do
    n <- getInt
    k <- getInt
    pure $ case  solve n k  of
      Nothing -> string7 "NO\n"
      Just li -> string7 "YES\n" <> foldMap putInts li

type SP = State P.ByteString
type S = StateT P.ByteString

dropSpace :: P.ByteString -> P.ByteString
dropSpace = P.dropWhile (<= ' ') -- not exactly right, but close enough

--getNext :: Monad m => S m P.ByteString
--getNext = state $ P.span (> ' ') . dropSpace

getInt :: Monad m => S m Int
getInt = state $ fromJust . P.readInt . dropSpace

putInts :: [Int] -> Builder
putInts vs = let
  sepPrim = (,) ' ' Prim.>$<
    Prim.liftFixedToBounded Prim.char7 Prim.>*< Prim.intDec
  in  case  vs  of
  [] -> char7 '\n'
  x : xs -> intDec x <> Prim.primMapListBounded sepPrim xs <> char7 '\n'

main :: IO ()
main = do
  hSetBuffering stdout NoBuffering
  inp <- P.getContents
  let  outp = evalState mainFun inp
  P.putStr $ toLazyByteString outp

import Control.Monad
import Data.List

main :: IO ()
main = do
    t <- readLn
    replicateM t $ do
        line <- getLine
        let [n, k] = map read $ words line :: [Int]
        let (possible, solution) = solve n k
        if possible
           then do
               putStrLn "YES"
               mapM_ (putStrLn . spaceSeparate) solution
           else putStrLn "NO"
    return ()

solve :: Int -> Int -> (Bool, [[Int]])
solve n k
  | k == 1          = (True, map (:[]) [1..n])
  | mod n 2 == 0    = (True, makeGrid n k)
  | otherwise       = (False, [])

-- first all the even numbers from 2 to n*k
-- then all the odd numbers from 1 to n*k
makeGrid :: Int -> Int -> [[Int]]
makeGrid n k =
    evens ++ odds
      where
          evens = [map (2*i*k+) [2,4..2*k] | i <- [0..mid-1]]
          odds = [map (2*i*k+) [1,3..2*k] | i <- [0..mid-1]]
          mid = div n 2

spaceSeparate :: (Show a) => [a] -> String
spaceSeparate xs = foldr (++) "" $ intersperse " " $ map show xs

import Control.Monad
import Data.List

main :: IO ()
main = do
    t <- readLn
    replicateM t $ do
        line <- getLine
        let [n, k] = map read $ words line :: [Int]
        let (possible, solution) = solve n k
        if possible
           then do
               putStrLn "YES"
               mapM_ putStrLn solution
           else putStrLn "NO"
    return ()

solve :: Int -> Int -> (Bool, [String])
solve n k
  | k == 1          = (True, map show [1..n])
  | mod n 2 == 0    = (True, map spaceSeparate $ makeGrid n k)
  | otherwise       = (False, [])

-- first all the even numbers from 2 to n*k
-- then all the odd numbers from 1 to n*k
makeGrid :: Int -> Int -> [[Int]]
makeGrid n k =
    evens ++ odds
      where
          evens = [map (2*i*k+) [2,4..2*k] | i <- [0..mid-1]]
          odds = [map (2*i*k+) [1,3..2*k] | i <- [0..mid-1]]
          mid = div n 2

spaceSeparate :: (Show a) => [a] -> String
spaceSeparate xs = foldr (++) "" $ intersperse " " $ map show xs

import Control.Monad
import Data.List

main :: IO ()
main = do
    t <- readLn
    replicateM t $ do
        line <- getLine
        let [n, k] = map read $ words line :: [Int]
        let (possible, solution) = solve n k
        if possible
           then do
               putStrLn "YES"
               mapM_ putStrLn solution
           else putStrLn "NO"
    return ()

solve :: Int -> Int -> (Bool, [String])
solve n k
  | k == 1          = (True, map show [1..n])
  | mod n 2 == 0    = (True, ans)
  | otherwise       = (False, [])
    where
        mid = div (n*k) 2
        ans = [spaceSeparate (map (i+) [2,4..k*2]) | i <- [0,2*k..mid-1]] ++
            [spaceSeparate (map (i+) [1,3..k*2]) | i <- [0,2*k..mid-1]]

spaceSeparate :: (Show a) => [a] -> String
spaceSeparate xs = foldr (++) "" $ intersperse " " $ map show xs

import Control.Monad
import Data.List

main :: IO ()
main = do
    t <- readLn
    replicateM t $ do
        line <- getLine
        let [n, k] = map read $ words line :: [Int]
        let (possible, solution) = solve n k
        if possible
           then do
               putStrLn "YES"
               mapM_ putStrLn solution
           else putStrLn "NO"
    return ()

solve :: Int -> Int -> (Bool, [String])
solve n k
  | k == 1          = (True, map show [1..n])
  | mod n 2 == 0    = (True, ans)
  | otherwise       = (False, [])
    where
        mid = div (n*k) 2
        ans = [spaceSeparate (map (i+) [2,4..k*2]) | i <- [0,k..mid-1]] ++
            [spaceSeparate (map (i+) [1,3..k*2]) | i <- [0,k..mid-1]]

spaceSeparate :: (Show a) => [a] -> String
spaceSeparate xs = foldr (++) "" $ intersperse " " $ map show xs


import Data.List
main = do
  [n, w] <- getLine >>= return. map read. words :: IO [Integer]
  a <- getLine >>= return. scanl (+) 0. map read. words
  print. max 0 $ 1 + w - maximum a + minimum a

import qualified Data.ByteString.Lazy.Char8 as B
import Data.List

main = do
  inp <- fmap B.lines $ B.getContents
  let [n,w] = map readI $ B.words $ inp!!0
  let as = map readI $ B.words $ inp!!1
  print (solve w as)

readI :: B.ByteString -> Int
readI s = case B.readInt s of Just (n,_) -> n

solve :: Int -> [Int] -> Int
solve w as =
  max c 0
  where
    c = w - u1 + 1 + (min 0 u0)

    bs = scanl (+) 0 as

    u1 = maximum bs
    u0 = minimum bs

import qualified Data.ByteString.Lazy.Char8 as B
import Data.List

main = do
  inp <- fmap B.lines $ B.getContents
  let [n,w] = map readI $ B.words $ inp!!0
  let as = map readI $ B.words $ inp!!1
  print (solve w as)

readI :: B.ByteString -> Int
readI s = case B.readInt s of Just (n,_) -> n

solve :: Int -> [Int] -> Int
solve w as =
  w - u1 + 1 + (min 0 u0)
  where
    bs = scanl (+) 0 as

    u1 = maximum bs
    u0 = minimum bs