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

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

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

i = A("i")
b = B("b")
h = C("h")
d = C("d")
j = C("j")
l = A("l")
e = B("e")
n = A("n")
c = C("c")

i.x = e
i.z = c
b.p = j
b.v = e
h.p = d
h.y = e
h.z = c
d.p = h
d.y = e
d.z = j
j.p = h
j.y = e
j.z = d
l.x = e
l.z = d
e.p = h
e.v = b
n.x = b
n.z = c
c.p = h
c.y = b
c.z = j
assert d.y.v.p.p.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: C = None
        self.txt = txt

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

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

i = A("i")
b = B("b")
h = C("h")
d = C("d")
j = C("j")
l = A("l")
e = B("e")
n = A("n")
c = C("c")

i.x = e
i.z = c
b.p = j
b.v = e
h.p = d
h.y = e
h.z = c
d.p = h
d.y = e
d.z = j
j.p = h
j.y = e
j.z = d
l.x = e
l.z = d
e.p = h
e.v = b
n.x = b
n.z = c
c.p = h
c.y = b
c.z = j
assert d.y.v.p.p.z.z.txt == "j"