/* package whatever; // don't place package name! */

import java.util.concurrent.ThreadLocalRandom;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	static char board[][];
	static boolean tryPlace(int x,int y,int width,int height) {
      for(int i=0;i<height;i++) {
        for(int j=0;j<width;j++) {
          if(board[y+i][x+j]!='.') {
            return false; // ship can not be placed
          }
        }
      }
      // if we reach here, ship can be placed
      for(int i=0;i<height;i++) {
        for(int j=0;j<width;j++) {
          board[y+i][x+j]='#';
        }
      }
      return true; // ship placed successfully
    }

	public static void main (String[] args) throws java.lang.Exception
	{
	  ThreadLocalRandom random=ThreadLocalRandom.current();
      board=new char[10][10];
      for(int i=0;i<10;i++)
        for(int j=0;j<10;j++)
          board[i][j]='.';

      int size=3;
      int amount=2;
      while(amount>0) {
        if(random.nextBoolean()) {
          // horizontal
          if(tryPlace(random.nextInt(10-size+1),random.nextInt(10),size,1)){
            amount--; // one placed
          }
        } else {
          // vertical
          if(tryPlace(random.nextInt(10),random.nextInt(10-size+1),1,size)){
            amount--; // one placed
          }
        }
      }

      // and a 4x2 mothership
      while(!(random.nextBoolean()
        ?tryPlace(random.nextInt(7),random.nextInt(9),4,2)
        :tryPlace(random.nextInt(9),random.nextInt(7),2,4)
      ));

      for(int i=0;i<10;i++)
        System.out.println(board[i]); // char[] has special overload for print/ln()
    }
}
