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

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

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

k = A("k")
m = B("m")
n = C("n")
l = B("l")
a = A("a")

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

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

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

k = A("k")
m = B("m")
n = C("n")
l = B("l")
a = A("a")

k.r = a
k.o = a
k.w = l
m.y = a
n.r = a
l.y = a
a.r = k
a.o = k
a.w = m
assert a.w.y.w.y.w.txt == "m"