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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: A = None
        self.v: H = None
        self.q: F = None
        self.t: E = None
        self.u: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: A = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
b = C("b")
e = D("e")
i = E("i")
m = F("m")
n = G("n")
g = H("g")
h = G("h")

d.r = m
d.z = l
l.x = d
l.s = h
b.z = e
b.u = e
b.r = d
b.v = g
b.q = m
b.t = i
e.s = d
e.u = l
i.r = l
m.u = h
m.w = d
n.t = i
n.p = m
g.w = l
h.t = i
h.p = m
assert d.r.w.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: A = None
        self.v: H = None
        self.q: F = None
        self.t: E = None
        self.u: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: A = None
        self.txt = txt

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

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

d = A("d")
l = B("l")
b = C("b")
e = D("e")
i = E("i")
m = F("m")
n = G("n")
g = H("g")
h = G("h")

d.r = m
d.z = l
l.x = d
l.s = h
b.z = e
b.u = e
b.r = d
b.v = g
b.q = m
b.t = i
e.s = d
e.u = l
i.r = l
m.u = h
m.w = d
n.t = i
n.p = m
g.w = l
h.t = i
h.p = m
assert d.r.w.z.s.txt == "h"