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

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

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

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

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

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

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

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

k.u = e
k.s = l
l.z = e
l.u = d
l.v = k
n.q = d
n.t = g
m.z = k
m.u = k
m.v = k
d.u = e
d.s = i
i.z = e
i.v = e
i.u = k
g.q = d
g.t = n
j.z = k
j.u = k
j.v = d
e.u = d
e.s = l
h.q = e
h.t = g
assert n.t.t.q.s.v.txt == "e"