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

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

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

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

n.v = a
n.y = a
n.o = j
j.r = b
j.v = l
b.w = n
b.z = l
b.t = l
l.r = a
l.v = j
a.w = m
a.z = j
a.t = j
m.v = b
m.y = b
m.o = j
assert j.v.r.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.o: B = None
        self.txt = txt

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

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

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

n.v = a
n.y = a
n.o = j
j.r = b
j.v = l
b.w = n
b.z = l
b.t = l
l.r = a
l.v = j
a.w = m
a.z = j
a.t = j
m.v = b
m.y = b
m.o = j
assert j.v.r.z.v.txt == "l"