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

class B:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

g = A("g")
h = B("h")
c = C("c")
i = B("i")
m = C("m")
n = C("n")
f = B("f")
d = C("d")
a = C("a")
b = C("b")

g.s = c
g.u = m
h.z = i
h.r = f
h.p = f
c.y = g
i.z = f
i.r = f
i.p = f
m.y = g
n.y = g
f.z = i
f.p = i
f.r = h
d.y = g
a.y = g
b.y = g
assert i.z.r.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

g = A("g")
h = B("h")
c = C("c")
i = B("i")
m = C("m")
n = C("n")
f = B("f")
d = C("d")
a = C("a")
b = C("b")

g.s = c
g.u = m
h.z = i
h.r = f
h.p = f
c.y = g
i.z = f
i.r = f
i.p = f
m.y = g
n.y = g
f.z = i
f.p = i
f.r = h
d.y = g
a.y = g
b.y = g
assert i.z.r.z.r.txt == "f"