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

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

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

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

f.y = m
f.p = e
c.o = m
c.s = d
m.v = f
m.p = f
l.v = e
l.p = e
e.y = l
e.p = k
d.o = l
d.s = c
k.y = l
k.p = e
assert f.y.v.p.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: A = None
        self.txt = txt

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

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

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

f.y = m
f.p = e
c.o = m
c.s = d
m.v = f
m.p = f
l.v = e
l.p = e
e.y = l
e.p = k
d.o = l
d.s = c
k.y = l
k.p = e
assert f.y.v.p.y.p.y.txt == "l"