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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: C = None
        self.p: A = None
        self.t: A = None
        self.s: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: C = None
        self.x: B = None
        self.o: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: C = None
        self.p: A = None
        self.t: A = None
        self.s: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: C = None
        self.x: B = None
        self.o: B = None
        self.txt = txt

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

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