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

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

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

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

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

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

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

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

n.t = b
j.v = k
j.w = a
a.r = k
a.v = k
a.t = e
k.r = a
k.v = a
k.t = e
e.v = a
e.w = a
l.v = a
l.w = a
b.t = n
assert k.t.w.v.r.t.w.txt == "a"