import java.util.Scanner;
public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
}
} import java.util.Scanner; Scanner java.util public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
}
} Main public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
} main {
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   } int i=1; int i=1; i 1 i>0 i 0 i++ i++ i {
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   } {
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   } int H = scanner.nextInt(); H scanner.nextInt() scanner.nextInt scanner int W = scanner.nextInt(); W scanner.nextInt() scanner.nextInt scanner if(H==0&&W==0)break; H==0&&W==0 H==0 H 0 W==0 W 0 break; for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          } int j=1; int j=1; j 1 j<=H j H j++ j++ j {
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          } {
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          } for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              } int k=1; int k=1; k 1 k<=W k W k++ k++ k {
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              } {
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              } if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                } 1<j&&1<k 1<j 1 j 1<k 1 k {
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                } if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    } j<H&&k<W j<H j H k<W k W {
                         System.out.print(".");
                    } System.out.print(".") System.out.print System.out System System.out "." {
                        System.out.print("#");
                    } System.out.print("#") System.out.print System.out System System.out "#" {
                   System.out.print("#");  
                } System.out.print("#") System.out.print System.out System System.out "#" System.out.println() System.out.println System.out System System.out System.out.println() System.out.println System.out System System.out String[] args args public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
}
} public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
}
} Main
import java.util.Scanner;
public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     for(int i=1;i>0; i++){
          int H = scanner.nextInt();
          int W = scanner.nextInt();
          if(H==0&&W==0)break;
          for(int j=1;j<=H; j++){
              for(int k=1;k<=W; k++){
                if(1<j&&1<k){
                    if(j<H&&k<W){
                         System.out.print(".");
                    }else{
                        System.out.print("#");
                    }
                }else{
                   System.out.print("#");  
                }
              }
              System.out.println();
          }
          System.out.println();
   }   
}
}