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

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

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

a = A("a")
d = B("d")
f = C("f")
l = B("l")
n = C("n")
k = B("k")
c = B("c")

a.q = n
d.v = a
d.r = a
d.t = l
f.o = k
l.v = a
l.r = a
l.t = d
n.o = l
k.v = a
k.r = a
k.t = c
c.v = a
c.r = a
c.t = k
assert a.q.o.t.t.r.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
f = C("f")
l = B("l")
n = C("n")
k = B("k")
c = B("c")

a.q = n
d.v = a
d.r = a
d.t = l
f.o = k
l.v = a
l.r = a
l.t = d
n.o = l
k.v = a
k.r = a
k.t = c
c.v = a
c.r = a
c.t = k
assert a.q.o.t.t.r.q.o.txt == "l"