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

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

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

k = A("k")
l = B("l")
b = C("b")
m = C("m")
g = B("g")
n = B("n")

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

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

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

k = A("k")
l = B("l")
b = C("b")
m = C("m")
g = B("g")
n = B("n")

k.v = m
k.o = b
l.r = k
l.v = k
l.w = b
b.t = k
b.z = n
b.v = m
m.t = k
m.z = n
m.v = b
g.r = k
g.v = k
g.w = m
n.r = k
n.v = k
n.w = m
assert n.w.t.v.v.t.txt == "k"