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

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

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

a = A("a")
m = B("m")
b = C("b")
k = B("k")
h = A("h")
i = B("i")
c = B("c")
l = C("l")
n = A("n")

a.o = i
a.r = k
m.v = i
b.o = n
b.v = n
b.w = h
k.v = i
h.o = k
h.r = i
i.v = m
c.v = i
l.o = n
l.v = n
l.w = h
n.o = m
n.r = c
assert i.v.v.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: B = None
        self.txt = txt

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

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

a = A("a")
m = B("m")
b = C("b")
k = B("k")
h = A("h")
i = B("i")
c = B("c")
l = C("l")
n = A("n")

a.o = i
a.r = k
m.v = i
b.o = n
b.v = n
b.w = h
k.v = i
h.o = k
h.r = i
i.v = m
c.v = i
l.o = n
l.v = n
l.w = h
n.o = m
n.r = c
assert i.v.v.v.v.v.v.v.v.txt == "i"