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

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

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

f = A("f")
m = B("m")
e = C("e")
l = A("l")
c = C("c")
b = A("b")
i = C("i")
n = A("n")
k = B("k")

f.x = n
m.o = k
m.p = f
e.r = b
e.v = c
e.w = f
l.x = b
c.r = l
c.v = e
c.w = f
b.x = f
i.r = b
i.w = b
i.v = e
n.x = l
k.o = m
k.p = n
assert k.p.x.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
e = C("e")
l = A("l")
c = C("c")
b = A("b")
i = C("i")
n = A("n")
k = B("k")

f.x = n
m.o = k
m.p = f
e.r = b
e.v = c
e.w = f
l.x = b
c.r = l
c.v = e
c.w = f
b.x = f
i.r = b
i.w = b
i.v = e
n.x = l
k.o = m
k.p = n
assert k.p.x.x.x.x.x.x.x.x.txt == "n"