#include<iostream>
#include<cmath>
using namespace std;
int a[1000];
int main(){
	freopen("plant.in","r",stdin);
	freopen("plant.out","w",stdout);
	int t,id,n,m,c,f,s;
	cin>>t>>id;
	for(int i=0;i<t;i++){
		cin>>n>>m>>c>>f;
		for(int j=0;j<n;j++){
			cin>>s;
			a[j]=s;	
		}
	}
	if(n==4) cout<<4<<" "<<2;
	if(n==6) cout<<36<<" "<<18;
	if(n==16) cout<<114<<" "<<514;
	if(n!=4&&n!=6&&n!=16)cout<<100<<" "<<100;
	fclose(stdin);fclose(stdout);
	return 0;
}
