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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: E = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: B = None
        self.t: C = None
        self.z: A = None
        self.q: C = None
        self.txt = txt

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

d = A("d")
f = B("f")
i = C("i")
c = D("c")
j = E("j")

d.o = f
d.z = c
d.r = j
f.s = c
f.w = c
i.r = f
i.y = j
i.z = j
i.t = c
c.o = i
c.t = i
c.q = i
c.x = f
c.z = d
j.z = d
j.u = d
assert i.t.x.s.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: D = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: E = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: B = None
        self.t: C = None
        self.z: A = None
        self.q: C = None
        self.txt = txt

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

d = A("d")
f = B("f")
i = C("i")
c = D("c")
j = E("j")

d.o = f
d.z = c
d.r = j
f.s = c
f.w = c
i.r = f
i.y = j
i.z = j
i.t = c
c.o = i
c.t = i
c.q = i
c.x = f
c.z = d
j.z = d
j.u = d
assert i.t.x.s.t.r.txt == "f"