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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

l.z = a
j.y = l
j.s = c
j.x = c
n.p = g
n.t = g
n.q = g
e.y = k
e.s = h
e.x = h
a.p = g
a.t = g
a.q = g
g.p = a
g.q = a
g.t = n
k.z = n
c.y = k
c.s = h
c.x = e
h.y = l
h.s = c
h.x = e
assert h.y.z.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

l.z = a
j.y = l
j.s = c
j.x = c
n.p = g
n.t = g
n.q = g
e.y = k
e.s = h
e.x = h
a.p = g
a.t = g
a.q = g
g.p = a
g.q = a
g.t = n
k.z = n
c.y = k
c.s = h
c.x = e
h.y = l
h.s = c
h.x = e
assert h.y.z.t.p.txt == "a"