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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.y: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

k = A("k")
d = B("d")
m = C("m")
c = D("c")
b = E("b")
f = D("f")

k.q = f
k.t = d
k.z = c
k.s = b
d.v = c
m.w = d
m.s = c
c.o = k
c.t = k
c.u = d
c.y = d
c.v = d
b.r = m
b.v = m
b.q = d
b.p = d
b.y = k
f.o = k
f.t = k
f.u = d
f.y = d
f.v = d
assert d.v.y.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.z: D = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.y: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

k = A("k")
d = B("d")
m = C("m")
c = D("c")
b = E("b")
f = D("f")

k.q = f
k.t = d
k.z = c
k.s = b
d.v = c
m.w = d
m.s = c
c.o = k
c.t = k
c.u = d
c.y = d
c.v = d
b.r = m
b.v = m
b.q = d
b.p = d
b.y = k
f.o = k
f.t = k
f.u = d
f.y = d
f.v = d
assert d.v.y.v.y.v.txt == "c"