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

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

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

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

j.z = l
j.u = i
j.t = g
d.u = h
d.z = g
e.u = j
e.q = l
h.u = l
h.q = j
l.z = j
l.u = g
l.t = d
g.u = h
g.z = d
i.u = h
i.z = d
assert j.z.t.z.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: B = None
        self.t: B = None
        self.txt = txt

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

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

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

j.z = l
j.u = i
j.t = g
d.u = h
d.z = g
e.u = j
e.q = l
h.u = l
h.q = j
l.z = j
l.u = g
l.t = d
g.u = h
g.z = d
i.u = h
i.z = d
assert j.z.t.z.u.q.txt == "j"