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

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

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

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

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

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

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

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

d.t = g
d.s = n
d.u = h
a.s = e
a.x = h
a.t = m
l.q = a
l.z = e
l.v = d
c.s = j
c.x = h
c.t = m
n.t = d
n.s = d
n.u = l
h.q = e
h.z = a
h.v = n
g.t = n
g.s = d
g.u = h
j.s = a
j.x = m
j.t = h
e.s = j
e.x = l
e.t = l
m.q = e
m.z = a
m.v = d
assert j.x.q.s.s.s.x.v.txt == "d"