#!/usr/bin/env python
# coding: utf-8

def wff(L): # dummy for now
	return True
def syl(L):
	mark = ['0']*7
	val = ''

	if wff(L):
		if L[0] == 'PaM':
			mark[0] = 'x'
			mark[3] = 'x'

		if L[0] == 'MaP':



		if L[1] == 'MaS':




		if L[1] == 'SaM':




		if 'e' in L[0]:
			mark[1] = 'x'
			mark[4] = 'x'

		if 'e' in L[1]:



		if 'i' in L[0]:
			if mark[1] == 'x':
				mark[4] = '+'
			elif mark[4] == 'x':
				mark[1] = '+'
			else:
				mark[1] = '+'
				mark[4] = '+'

		if 'i' in L[1]:







		if L[0] == 'PoM':
			if mark[0] == 'x':
				mark[3] = '+'
			elif mark[3] == 'x':
				mark[0] = '+'
			else:
				mark[0] = '+'
				mark[3] = '+'

		if L[0] == 'MoP':








		if L[1] == 'SoM':








		if L[1] == 'MoS':








		if L[2] == 'SaP' and mark[5] == 'x' and mark[6] == 'x':
			val = 'valid'
		elif 
        
		elif L[2] == 'SiP':
			if (mark[0] == 'x' and mark[1] == 'x' and mark[4] == 'x') or (mark[0] == 'x' and mark[1] == 'x' and mark[3] == 'x') or (mark[3] == 'x' and mark[5] == 'x' and mark[6] == 'x') or (mark[1] == 'x' and mark[2] == 'x' and mark[5] == 'x'):
				val = 'valid'
			if mark[4] == '+':
				if mark[5] == 'x' and mark[1] == '0':
					val = 'valid'
				elif mark[1] == 'x' and mark[5] == '0':
					val = 'valid'
				else:
					mark[4] = '0'
					mark[3] = '0'
		elif L[2] == 'SoP':
			if (mark[3] == 'x' and mark[4] == 'x' and mark[5] == 'x') or (mark[3] == 'x' and mark[4] == 'x' and mark[6] == 'x') or (mark[1] == 'x' and mark[2] == 'x' and mark[4] == 'x'):
				val = 'valid'
			if mark[5] == '+':
				if mark[2] == 'x' and mark[4] == '0':
					val = 'valid'
				elif 
                
				else:
					mark[5] = '0'
			if mark[6] == '+':
				if mark[3] == 'x' and mark[5] == '0':
					val = 'valid'
				elif 
                
				else:
					mark[6] = '0'
		if val == '':
			val = 'invalid'
	return val, L

#assorted valid/invalid:
#print syl(['MeP','SiM','SoP'])
#print(syl(['MeP','MiS','SoP']))
#print(syl(['MaP','SiM','SaP']))
#print(syl(['PaM','MiS','SiP']))
#print(syl(['MiP','SaM','SiP']))
#1 valid SaP:
#print(syl(['MaP','SaM','SaP']))
#4 valid SeP:
#print(syl(['MeP','SaM','SeP']))
#print(syl(['PeM','SaM','SeP']))
#print(syl(['PaM','SeM','SeP']))
#print(syl(['PaM','MeS','SeP']))
#7 valid SiP:
#print(syl(['MaP','SaM','SiP']))
#print(syl(['MaP','SiM','SiP']))
#print(syl(['MaP','MaS','SiP']))
#print(syl(['MiP','MaS','SiP']))
#print(syl(['MaP','MiS','SiP']))
#print(syl(['PaM','MaS','SiP']))
#print(syl(['PiM','MaS','SiP']))
#12 valid SoP:
#print(syl(['MeP','SaM','SoP']))
#print(syl(['MeP','SiM','SoP']))
#print(syl(['PeM','SaM','SoP']))
#print(syl(['PeM','SiM','SoP']))
#print(syl(['PaM','SeM','SoP']))
#print(syl(['PaM','SoM','SoP']))
#print(syl(['MeP','MaS','SoP']))
#print(syl(['MeP','MiS','SoP']))
#print(syl(['MoP','MaS','SoP']))
#print(syl(['PaM','MeS','SoP']))
#print(syl(['PeM','MaS','SoP']))
#print(syl(['PeM','MiS','SoP']))
