class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

l = A("l")
n = B("n")
a = C("a")

l.x = a
l.u = a
l.p = n
n.y = a
n.z = l
a.s = n
assert a.s.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

l = A("l")
n = B("n")
a = C("a")

l.x = a
l.u = a
l.p = n
n.y = a
n.z = l
a.s = n
assert a.s.z.x.txt == "a"