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

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

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

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

f = A("f")
i = B("i")
m = C("m")
l = D("l")
n = D("n")
d = B("d")
b = C("b")
e = D("e")
j = B("j")

f.x = j
i.o = n
i.q = m
i.v = l
m.t = d
m.w = e
m.q = b
l.y = d
n.y = j
d.o = l
d.v = l
d.q = m
b.t = d
b.w = n
b.q = m
e.y = d
j.o = l
j.v = l
j.q = b
assert m.q.t.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
m = C("m")
l = D("l")
n = D("n")
d = B("d")
b = C("b")
e = D("e")
j = B("j")

f.x = j
i.o = n
i.q = m
i.v = l
m.t = d
m.w = e
m.q = b
l.y = d
n.y = j
d.o = l
d.v = l
d.q = m
b.t = d
b.w = n
b.q = m
e.y = d
j.o = l
j.v = l
j.q = b
assert m.q.t.q.q.q.q.txt == "b"