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

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

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

h = A("h")
i = B("i")
a = C("a")
l = C("l")
d = B("d")
c = C("c")
f = B("f")
b = C("b")
j = A("j")
g = B("g")

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

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

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

h = A("h")
i = B("i")
a = C("a")
l = C("l")
d = B("d")
c = C("c")
f = B("f")
b = C("b")
j = A("j")
g = B("g")

h.q = g
i.u = a
i.z = l
a.s = g
a.t = j
l.s = f
l.t = h
d.u = b
d.z = a
c.s = g
c.t = h
f.u = a
f.z = a
b.s = g
b.t = h
j.q = g
g.u = l
g.z = b
assert l.t.q.z.s.z.s.z.txt == "b"