
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
An ellipse $C$ with two coordinate axes as axes of symmetry passes through the points $P(\sqrt{2},1)$ and $Q(0,-\sqrt{2})$. Line $l$ intersects ellipse $C$ at points $A$ and $B$, with $M$ being the midpoint of segment $AB$.  
$(1)$ Find the equation of ellipse $C$;  
$(2)$ If the coordinates of point $M$ are $(-\frac{2}{3},\frac{1}{3})$, find the equation of line $l$.

Present the answer in LaTex format: \boxed{Your answer}
user