<INSTRUCTIONS>
You are tasked with producing a closed-form analytical solution for the inverse kinematics of the 5 degrees-of-freedom serial manipulator solving for the position and orientation of the TCP as detailed in the "DETAILS" section by completing the Python function provided in the "CODE" section. The "Position" and "Orientation" columns represent link coordinates in local space relative to their parent link. The positions are from the "xyx" attribute and the orientations are the "rpy" attribute from each link's "origin" element parsed from the URDF. The "Axis" column in the table represents the rotational axis of the revolute links; return their values in radians and their limits are in radians. Do not write any code to run or test the method, as this will be handled for you. Assume all targets given as inputs to the method will be reachable, and as such do not write code to check if the target is reachable. You may use any methods included in Python, NumPy, and SymPy to write your solution except for any optimization methods.
</INSTRUCTIONS>
<DETAILS>
 Link       | Position            | Orientation         | Axis   | Limits
------------+---------------------+---------------------+--------+-------------------------
 Revolute 1 | [0, 0, 0]           | [0, 0, 0]           | Y      | [-6.2831853, 6.2831853]
 Revolute 2 | [0, -0.1197, 0.425] | [0, 0, 0]           | Y      | [-6.2831853, 6.2831853]
 Revolute 3 | [0, 0, 0.39225]     | [0, 0, 0]           | Y      | [-6.2831853, 6.2831853]
 Revolute 4 | [0, 0.093, 0]       | [0, 0, 0]           | Z      | [-6.2831853, 6.2831853]
 Revolute 5 | [0, 0, 0.09465]     | [0, 0, 0]           | Y      | [-6.2831853, 6.2831853]
 TCP        | [0, 0.0823, 0]      | [0, 0, 1.570796325] |        |
</DETAILS>
<CODE>
def inverse_kinematics(p: tuple[float, float, float], r: tuple[float, float, float]) -> tuple[float, float, float, float, float]:
    """
    Gets the joint values needed to reach position "p" and orientation "r".
    :param p: The position to reach in the form [x, y, z].
    :param r: The orientation to reach in radians in the form [x, y, z].
    :return: A list of the values to set the links to for reaching position "p" and orientation "r".
    """
</CODE>