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

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

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

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

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

e = A("e")
c = B("c")
d = C("d")
g = D("g")
f = E("f")

e.o = g
c.q = e
c.u = d
c.s = d
d.v = c
d.o = c
d.z = g
g.t = f
g.q = f
g.s = c
f.v = d
f.r = d
f.y = c
f.o = e
f.z = e
assert c.u.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

e = A("e")
c = B("c")
d = C("d")
g = D("g")
f = E("f")

e.o = g
c.q = e
c.u = d
c.s = d
d.v = c
d.o = c
d.z = g
g.t = f
g.q = f
g.s = c
f.v = d
f.r = d
f.y = c
f.o = e
f.z = e
assert c.u.z.q.txt == "f"