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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

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

j = A("j")
c = B("c")
e = C("e")
b = A("b")
f = B("f")
g = A("g")
h = A("h")
n = C("n")

j.z = g
j.p = e
c.q = f
c.v = f
c.y = f
e.s = h
e.u = g
b.z = g
b.p = n
f.q = c
f.v = c
f.y = c
g.z = h
g.p = n
h.z = g
h.p = n
n.s = h
n.u = h
assert g.p.u.p.u.z.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

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

j = A("j")
c = B("c")
e = C("e")
b = A("b")
f = B("f")
g = A("g")
h = A("h")
n = C("n")

j.z = g
j.p = e
c.q = f
c.v = f
c.y = f
e.s = h
e.u = g
b.z = g
b.p = n
f.q = c
f.v = c
f.y = c
g.z = h
g.p = n
h.z = g
h.p = n
n.s = h
n.u = h
assert g.p.u.p.u.z.p.s.txt == "h"