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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: E = None
        self.o: C = None
        self.x: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.r: F = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.t: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: C = None
        self.o: A = None
        self.p: B = None
        self.r: F = None
        self.txt = txt

h = A("h")
l = B("l")
i = C("i")
k = D("k")
d = E("d")
b = F("b")
a = G("a")
f = H("f")
c = B("c")
m = A("m")

h.q = c
h.x = d
h.r = k
l.x = f
i.x = c
i.u = a
k.s = d
k.v = d
k.o = i
k.x = a
d.v = f
d.y = f
d.r = b
b.t = d
a.z = f
a.t = c
f.w = b
f.r = b
f.y = i
f.o = h
f.p = c
c.x = f
m.q = c
m.x = d
m.r = k
assert d.r.t.v.p.x.o.x.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: E = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: E = None
        self.o: C = None
        self.x: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: H = None
        self.r: F = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.t: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: C = None
        self.o: A = None
        self.p: B = None
        self.r: F = None
        self.txt = txt

h = A("h")
l = B("l")
i = C("i")
k = D("k")
d = E("d")
b = F("b")
a = G("a")
f = H("f")
c = B("c")
m = A("m")

h.q = c
h.x = d
h.r = k
l.x = f
i.x = c
i.u = a
k.s = d
k.v = d
k.o = i
k.x = a
d.v = f
d.y = f
d.r = b
b.t = d
a.z = f
a.t = c
f.w = b
f.r = b
f.y = i
f.o = h
f.p = c
c.x = f
m.q = c
m.x = d
m.r = k
assert d.r.t.v.p.x.o.x.r.t.txt == "d"