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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: A = None
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

j = A("j")
d = B("d")
h = C("h")
c = D("c")
g = E("g")
e = C("e")
i = E("i")
k = E("k")

j.q = d
j.y = d
j.z = c
d.o = e
h.t = e
h.r = k
c.v = e
c.p = j
c.u = j
c.s = j
g.y = d
g.r = d
g.v = d
g.w = e
e.t = h
e.r = i
i.y = d
i.r = d
i.v = d
i.w = e
k.y = d
k.r = d
k.v = d
k.w = e
assert h.r.w.t.t.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: D = None
        self.y: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: A = None
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

j = A("j")
d = B("d")
h = C("h")
c = D("c")
g = E("g")
e = C("e")
i = E("i")
k = E("k")

j.q = d
j.y = d
j.z = c
d.o = e
h.t = e
h.r = k
c.v = e
c.p = j
c.u = j
c.s = j
g.y = d
g.r = d
g.v = d
g.w = e
e.t = h
e.r = i
i.y = d
i.r = d
i.v = d
i.w = e
k.y = d
k.r = d
k.v = d
k.w = e
assert h.r.w.t.t.t.r.txt == "k"