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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: B = None
        self.z: B = None
        self.w: C = None
        self.v: C = None
        self.txt = txt

k = A("k")
m = B("m")
i = C("i")
j = D("j")
f = E("f")
h = C("h")
d = B("d")
g = A("g")

k.y = i
m.q = g
m.v = k
m.w = k
m.u = j
i.x = h
i.y = h
j.w = i
j.t = m
j.s = f
f.u = k
f.s = m
f.z = m
f.w = h
f.v = h
h.x = i
h.y = i
d.q = k
d.w = k
d.v = g
d.u = j
g.y = h
assert k.y.x.y.x.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: B = None
        self.z: B = None
        self.w: C = None
        self.v: C = None
        self.txt = txt

k = A("k")
m = B("m")
i = C("i")
j = D("j")
f = E("f")
h = C("h")
d = B("d")
g = A("g")

k.y = i
m.q = g
m.v = k
m.w = k
m.u = j
i.x = h
i.y = h
j.w = i
j.t = m
j.s = f
f.u = k
f.s = m
f.z = m
f.w = h
f.v = h
h.x = i
h.y = i
d.q = k
d.w = k
d.v = g
d.u = j
g.y = h
assert k.y.x.y.x.y.y.txt == "h"