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

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

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

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

j.t = a
i.x = e
i.r = e
i.q = k
e.v = j
n.t = e
l.t = b
b.v = n
a.v = l
k.x = e
k.r = b
k.q = i
assert j.t.v.t.v.t.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

j.t = a
i.x = e
i.r = e
i.q = k
e.v = j
n.t = e
l.t = b
b.v = n
a.v = l
k.x = e
k.r = b
k.q = i
assert j.t.v.t.v.t.v.t.v.txt == "l"