Generate a Python program that has the following intention:

The intention of the program is to generate a flat list of all the elements in a nested list, recursively.

The function p1 takes a list as input and iterates over each element using a while loop. It first checks if the element is a list, using the isinstance function. If it is not a list, it yields the element directly. If it is a list, it recursively calls p1 on the list and yields all the elements returned by the recursive calls.

The for loop in the else block is used to iterate over the elements returned by the recursive calls and to yield them.

The overall effect of the program is to flatten a nested list into a flat list, where each element is either an element of the original list or a list of elements from a nested list.