import qualified Control.Monad as CM main :: IO () main = do n<- readLn ss<- CM.replicateM n (map read.words<$>getLine) let ans =map(map (floor.sqrt))ss ans1=map(map((\x->[x-2,x-1,x,x+1,x+2]).floor.sqrt))ss ans3=map (maximum . (\(x,y)->takeWhile(<=head x)y)) (zipWith (curry (\([x],y)->([x],concat y))) ans ans1) putStr$unlines$map show ans3