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

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

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

b = A("b")
i = B("i")
h = C("h")
g = A("g")
c = B("c")
j = C("j")
d = A("d")
l = C("l")
k = C("k")
m = B("m")

b.s = h
b.v = d
b.x = c
i.r = j
i.q = m
h.u = d
h.t = d
g.s = h
g.v = d
g.x = i
c.r = j
c.q = m
j.u = b
j.t = d
d.s = j
d.v = g
d.x = c
l.u = d
l.t = g
k.u = b
k.t = d
m.r = h
m.q = i
assert d.x.q.r.u.x.r.t.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: A = None
        self.x: B = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
h = C("h")
g = A("g")
c = B("c")
j = C("j")
d = A("d")
l = C("l")
k = C("k")
m = B("m")

b.s = h
b.v = d
b.x = c
i.r = j
i.q = m
h.u = d
h.t = d
g.s = h
g.v = d
g.x = i
c.r = j
c.q = m
j.u = b
j.t = d
d.s = j
d.v = g
d.x = c
l.u = d
l.t = g
k.u = b
k.t = d
m.r = h
m.q = i
assert d.x.q.r.u.x.r.t.v.s.txt == "h"