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

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

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

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

j = A("j")
m = B("m")
i = C("i")
k = D("k")
h = D("h")
e = C("e")
f = D("f")
n = A("n")

j.w = f
j.s = h
m.p = i
m.t = j
i.q = e
k.x = i
k.w = f
k.s = m
k.z = e
h.x = e
h.w = k
h.s = m
h.z = i
e.q = i
f.x = i
f.z = i
f.w = h
f.s = m
n.w = h
n.s = h
assert j.s.x.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: D = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
i = C("i")
k = D("k")
h = D("h")
e = C("e")
f = D("f")
n = A("n")

j.w = f
j.s = h
m.p = i
m.t = j
i.q = e
k.x = i
k.w = f
k.s = m
k.z = e
h.x = e
h.w = k
h.s = m
h.z = i
e.q = i
f.x = i
f.z = i
f.w = h
f.s = m
n.w = h
n.s = h
assert j.s.x.q.q.q.q.q.txt == "i"