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

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

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

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

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

i = A("i")
d = B("d")
a = C("a")
k = D("k")
h = E("h")
b = C("b")
f = B("f")
e = A("e")

i.t = k
d.w = f
d.q = k
d.x = k
a.p = k
a.s = d
k.o = f
h.p = d
h.q = e
b.p = k
b.s = f
f.w = d
f.q = k
f.x = k
e.t = k
assert b.s.x.o.x.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

i = A("i")
d = B("d")
a = C("a")
k = D("k")
h = E("h")
b = C("b")
f = B("f")
e = A("e")

i.t = k
d.w = f
d.q = k
d.x = k
a.p = k
a.s = d
k.o = f
h.p = d
h.q = e
b.p = k
b.s = f
f.w = d
f.q = k
f.x = k
e.t = k
assert b.s.x.o.x.o.w.txt == "d"