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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: A = None
        self.w: C = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

m = A("m")
b = B("b")
d = C("d")
a = D("a")
c = E("c")
i = B("i")

m.y = d
b.z = c
b.u = c
b.p = i
b.o = i
d.u = a
d.y = m
d.r = c
a.z = i
c.r = b
c.t = m
c.o = m
c.w = d
c.x = d
i.z = c
i.u = c
i.p = b
i.o = b
assert c.r.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: A = None
        self.w: C = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

m = A("m")
b = B("b")
d = C("d")
a = D("a")
c = E("c")
i = B("i")

m.y = d
b.z = c
b.u = c
b.p = i
b.o = i
d.u = a
d.y = m
d.r = c
a.z = i
c.r = b
c.t = m
c.o = m
c.w = d
c.x = d
i.z = c
i.u = c
i.p = b
i.o = b
assert c.r.u.t.txt == "m"