class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: 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.v: A = None
        self.txt = txt

d = A("d")
j = B("j")
n = C("n")
m = B("m")
e = A("e")
h = A("h")
c = A("c")
k = B("k")
f = C("f")
l = C("l")

d.s = j
d.q = k
j.t = n
n.v = d
m.t = n
e.s = k
e.q = j
h.s = m
h.q = m
c.s = k
c.q = k
k.t = l
f.v = c
l.v = c
assert l.v.q.t.v.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: 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.v: A = None
        self.txt = txt

d = A("d")
j = B("j")
n = C("n")
m = B("m")
e = A("e")
h = A("h")
c = A("c")
k = B("k")
f = C("f")
l = C("l")

d.s = j
d.q = k
j.t = n
n.v = d
m.t = n
e.s = k
e.q = j
h.s = m
h.q = m
c.s = k
c.q = k
k.t = l
f.v = c
l.v = c
assert l.v.q.t.v.q.t.txt == "l"