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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

a = A("a")
i = B("i")
c = C("c")
e = A("e")

a.z = i
a.u = e
i.v = e
c.r = e
e.z = i
e.u = a
assert e.z.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

a = A("a")
i = B("i")
c = C("c")
e = A("e")

a.z = i
a.u = e
i.v = e
c.r = e
e.z = i
e.u = a
assert e.z.v.u.txt == "a"