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

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

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

g = A("g")
h = B("h")
d = C("d")
c = C("c")
a = B("a")
e = C("e")
i = B("i")
k = B("k")
j = C("j")

g.y = c
g.z = j
h.r = e
d.p = g
d.w = g
d.u = g
c.p = g
c.w = g
c.u = g
a.r = d
e.p = g
e.w = g
e.u = g
i.r = e
k.r = e
j.p = g
j.w = g
j.u = g
assert c.u.z.w.y.u.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.txt = txt

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

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

g = A("g")
h = B("h")
d = C("d")
c = C("c")
a = B("a")
e = C("e")
i = B("i")
k = B("k")
j = C("j")

g.y = c
g.z = j
h.r = e
d.p = g
d.w = g
d.u = g
c.p = g
c.w = g
c.u = g
a.r = d
e.p = g
e.w = g
e.u = g
i.r = e
k.r = e
j.p = g
j.w = g
j.u = g
assert c.u.z.w.y.u.z.p.txt == "g"