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

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

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

i = A("i")
h = B("h")
g = C("g")
b = A("b")
c = B("c")
l = A("l")
n = C("n")
m = C("m")
k = A("k")
e = B("e")

i.z = e
h.q = b
h.x = i
h.y = g
g.s = h
g.x = k
b.z = e
c.q = k
c.x = l
c.y = n
l.z = c
n.s = e
n.x = i
m.s = c
m.x = i
k.z = e
e.q = k
e.x = l
e.y = m
assert b.z.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
g = C("g")
b = A("b")
c = B("c")
l = A("l")
n = C("n")
m = C("m")
k = A("k")
e = B("e")

i.z = e
h.q = b
h.x = i
h.y = g
g.s = h
g.x = k
b.z = e
c.q = k
c.x = l
c.y = n
l.z = c
n.s = e
n.x = i
m.s = c
m.x = i
k.z = e
e.q = k
e.x = l
e.y = m
assert b.z.y.x.txt == "i"