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

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

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

m = A("m")
l = B("l")
c = C("c")
e = C("e")
k = A("k")

m.r = l
m.w = l
l.o = k
c.q = e
c.w = e
c.v = e
e.q = c
e.w = c
e.v = c
k.r = l
k.w = l
assert e.q.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
c = C("c")
e = C("e")
k = A("k")

m.r = l
m.w = l
l.o = k
c.q = e
c.w = e
c.v = e
e.q = c
e.w = c
e.v = c
k.r = l
k.w = l
assert e.q.v.v.v.txt == "e"