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

import Debug.Trace

main = do
  [a,b] <- fmap (map read . words) getLine
  ans <- solve a b
  putStrLn $ show (length ans) ++ " " ++ show(length(head ans))
  mapM_ putStrLn ans

type Grid = IOArray (Int,Int) Char

solve :: Int -> Int -> IO [String]
solve a b = do
  g <- newArray ((1,1),(100,100)) '.'
  n <- solve1 g 1 a' b'
  g' <- fmap (ixmap ((1,1),(n,n+1)) id) (freeze g)
  let ans = split (n+1) $ elems g'
  return $ (if a==a' then id else map (map invert)) ans

  where
    invert '.' = '#'
    invert '#' = '.'
    invert c   = c

    (a',b') = (min a b, max a b)


split :: Int -> [a] -> [[a]]
split n =
  unfoldr f
  where
    f [] = Nothing
    f ys = let (as,bs) = splitAt n ys in Just (as,bs)

solve1 :: Grid -> Int -> Int -> Int -> IO Int
solve1 g n w b
--  | traceShow (n,w,b) False = undefined
  | w == 0 && b == 0 = do
      return (n-1)
  | w == 0           = do
--      trace "w==0" (return ())
      sequence_ [black g (x,y) | (x,y)<-tail $ direction $ line n]
      solve2 g (n+2) (b+n-2) '.'
  | n <= w && n <= b = do
      sequence_ [black g (x,y) | (x,y)<-line n, even(x+y)]
      solve1 g (n+1) (w-n) (b-n)
  | w < n && b < n   = do
      sequence_ [black g (x,y) | (x,y)<- direction $ line n]
      n' <- solve2 g (n+1) w '#'
      solve2 g (n'+2) (b+n-3 + (if w > 1 then 1 else 0)) '.'
  | otherwise        = do
--      trace "otherwise" (return ())
      sequence_ [black g (x,y) | (x,y)<-line n, even(x+y)]
      sequence_ $ take (max 0 w) [black g (x,y) | (x,y)<-direction $ line (n+1), odd(x+y),(x,y)/=(n,n+1)]
      sequence_ [black g (x,y) | (x,y)<-init $ direction $ line (n+2)]
      solve2 g (n+4) (b-w) '.'
  where
    direction = if even n then id else reverse


solve2 :: Grid -> Int -> Int -> Char -> IO Int
solve2 g n 0 c =
  return (n-1)
solve2 g n t c = do
--  traceShow (n,t,c) (return ())
  sequence_ [paintr (x,y) | (x,y)<-init $ line n]
  sequence_ paintLine
  sequence_ [paint (x,y) | (x,y)<-init $ line (n+1)]
  if t <= paintLineN then return (n+1) else solve2 g (n+2) (t-paintLineN) c
  where
    paint = if c=='#' then black g else white g
    paintr = if c=='#' then white g else black g

    paintLine = take (t-1) [paint (x,y) | (x,y)<-init $ line n, (if even n then odd else even) (x+y)]
    paintLineN = length paintLine + 1

line :: Int -> [(Int,Int)]
line k = [(x,k+1)|x<-[1..k]] ++ [(k,y)|y<-[k,k-1..1]]

black :: Grid -> (Int,Int) -> IO ()
black g ix = writeArray g ix '#'

white :: Grid -> (Int,Int) -> IO ()
white g ix = writeArray g ix '.'