#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>

using namespace std;

void rect(int w, int h)
{
	cout << string(w, '*') << endl;
	for(int i = 0; i < h - 2; ++i)
		cout << '*' << string(w - 2, ' ') << '*' << endl;
	cout << string(w, '*') << endl;
}
int main()
{
	rect(8, 5);
}