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

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

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

l = A("l")
a = B("a")
e = C("e")
h = C("h")
j = C("j")
n = A("n")
b = C("b")

l.w = h
l.q = e
l.u = a
a.t = h
e.q = b
h.q = j
j.q = b
n.w = j
n.q = j
n.u = a
b.q = j
assert l.q.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: C = None
        self.u: B = None
        self.txt = txt

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

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

l = A("l")
a = B("a")
e = C("e")
h = C("h")
j = C("j")
n = A("n")
b = C("b")

l.w = h
l.q = e
l.u = a
a.t = h
e.q = b
h.q = j
j.q = b
n.w = j
n.q = j
n.u = a
b.q = j
assert l.q.q.q.q.q.q.q.txt == "j"