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

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

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

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

c.x = j
c.y = g
c.z = h
h.z = a
h.u = d
j.x = e
a.z = h
a.u = d
e.x = j
e.y = g
e.z = d
g.x = j
g.y = c
g.z = h
d.z = a
d.u = h
l.x = j
l.y = e
l.z = d
assert g.x.x.y.z.z.z.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: A = None
        self.z: B = None
        self.txt = txt

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

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

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

c.x = j
c.y = g
c.z = h
h.z = a
h.u = d
j.x = e
a.z = h
a.u = d
e.x = j
e.y = g
e.z = d
g.x = j
g.y = c
g.z = h
d.z = a
d.u = h
l.x = j
l.y = e
l.z = d
assert g.x.x.y.z.z.z.z.u.txt == "d"