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

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

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

j = A("j")
e = B("e")
n = C("n")
f = B("f")
d = B("d")
h = A("h")
m = B("m")
k = C("k")
i = B("i")
b = B("b")

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

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

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

j = A("j")
e = B("e")
n = C("n")
f = B("f")
d = B("d")
h = A("h")
m = B("m")
k = C("k")
i = B("i")
b = B("b")

j.y = h
j.q = n
e.z = f
e.s = h
e.y = n
n.p = h
n.y = i
f.z = i
f.s = j
f.y = n
d.z = f
d.s = j
d.y = n
h.y = j
h.q = k
m.z = f
m.s = h
m.y = n
k.p = j
k.y = m
i.z = d
i.s = h
i.y = k
b.z = f
b.s = h
b.y = n
assert m.y.p.y.txt == "j"