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

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

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

k = A("k")
n = B("n")
l = C("l")
f = A("f")
h = C("h")
a = B("a")
g = C("g")
d = A("d")

k.q = n
k.t = l
k.u = g
n.t = f
n.z = f
n.x = l
l.q = g
l.u = f
f.q = a
f.t = l
f.u = g
h.q = g
h.u = f
a.t = f
a.z = f
a.x = l
g.q = l
g.u = d
d.q = n
d.t = g
d.u = l
assert a.x.q.u.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: C = None
        self.u: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
l = C("l")
f = A("f")
h = C("h")
a = B("a")
g = C("g")
d = A("d")

k.q = n
k.t = l
k.u = g
n.t = f
n.z = f
n.x = l
l.q = g
l.u = f
f.q = a
f.t = l
f.u = g
h.q = g
h.u = f
a.t = f
a.z = f
a.x = l
g.q = l
g.u = d
d.q = n
d.t = g
d.u = l
assert a.x.q.u.q.z.txt == "f"