Serial Schedules Transactions?

I’ve got a class with three transactions (T1,T2,T3). They all read and write certain items, and I am trying to work out a method to write all permutations for a serial schedule for these transactions. Except I kinda stumped on the method, could anyone help me out with some code? I would really appreciate it!

T1: read_item(X);
write_item(X);
read_item(Y);
write_item(Y);

T2: read_item(Z);
read_item(Y);
write_item(Y);
read_item(X);
write_item(X);

T3: read_item(Y);
read_item(Z);
write_item(Y);
write_item(Z);

I appreciate anyone’s help with this! :smiley: Thank you.