algorithms – Ordering puzzle problem- It is NP?

Suppose there are ‘n’ number of food items in a party.
f1 , f2 ….,fn.
In which order we eat them matters. Each ordering should contain all items included.
Some order in which I choose the food items may give me cancer.( there can be more than one such ordering).

Every food item is made and represented by three categories of ingredients: vegetables, spices and meat.

Set of types of vegetables: {a,b,c}.

Set of types of spices: {e,f,g}

Set of types of meat: {x,y,z}

Detecting Cancer: If all vegetables or spices or meat of any one type are eaten at the start or at the end before any another type, then that ordering is cancerous.

For example,
(1) f1 is made of {a,f,x} ;
f2 is made of {a,e,y} ;
f3 is made of {c,g,z} ;
f4 is made of {b,f,y} ;

a) ordering f1,f2,f3,f4:
Based on vegetables:{a,a,c,b} all a’s are eaten at the start, therefore this ordering is cancerous.
Based on spices:{f,e,g,f} , meat:{x,y,z,y} not cancerous as no type is continuously eaten at the start or end. Therefore, this order is cancerous based on vegetables.

b) ordering f1,f3,f2,f4:
Based on vegetables:{a,c,a,b} not cancerous ;
Based on spices:{f,g,e,f} not cancerous ;
Based on meat:{x,z,y,y} cancerous because all meat of type ‘y’ are eaten continuously at the end.

c) ordering f1,f2,f4,f3 :
Based on meat:{x,y,y,z} not cancerous(based on meat) because all meat of type ‘y’ are eaten in the middle, not at the start or end.
Based on vegetables:{a,a,b,c} all a’s are eaten at the start, therefore this ordering is cancerous.

There is a doctor at the party who can take a look at any given order (one at a time) and checks if it is cancerous or not (based on above conditions) in O(n).

Question 1: Can I detect if the given food items are given such that all orders are be cancerous?

Question 2: If somehow I find that there exist non-cancerous orders, how to make a cancerous order into non-cancerous order by swapping food items?

Question 3: Can I optimize the swappings in Question 2?