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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.o: D = None
        self.txt = txt

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

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

d.s = j
d.x = h
j.w = h
j.r = m
l.q = d
l.v = h
l.o = m
k.x = d
k.u = j
i.q = d
i.v = f
i.o = m
f.q = d
f.v = l
f.o = m
m.x = d
m.u = j
h.q = d
h.v = l
h.o = m
assert m.u.w.v.o.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.o: D = None
        self.txt = txt

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

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

d.s = j
d.x = h
j.w = h
j.r = m
l.q = d
l.v = h
l.o = m
k.x = d
k.u = j
i.q = d
i.v = f
i.o = m
f.q = d
f.v = l
f.o = m
m.x = d
m.u = j
h.q = d
h.v = l
h.o = m
assert m.u.w.v.o.u.w.txt == "h"