generating perfect tables