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

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

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

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

f.y = n
f.p = e
l.x = k
l.y = n
k.s = i
k.z = f
e.s = i
e.z = n
b.s = i
b.z = n
n.y = f
n.p = b
c.x = b
c.y = f
i.x = e
i.y = f
m.x = b
m.y = n
d.x = k
d.y = n
assert m.x.s.x.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: C = None
        self.txt = txt

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

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

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

f.y = n
f.p = e
l.x = k
l.y = n
k.s = i
k.z = f
e.s = i
e.z = n
b.s = i
b.z = n
n.y = f
n.p = b
c.x = b
c.y = f
i.x = e
i.y = f
m.x = b
m.y = n
d.x = k
d.y = n
assert m.x.s.x.z.y.txt == "f"