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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: B = None
        self.q: H = None
        self.y: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: H = None
        self.u: F = None
        self.w: C = None
        self.z: H = None
        self.s: A = None
        self.r: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.p: F = None
        self.s: A = None
        self.q: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

b.r = g
b.u = h
b.y = l
b.v = e
m.p = e
m.r = l
m.q = i
m.x = g
l.x = b
g.o = m
g.w = m
g.q = h
g.y = i
e.p = g
e.v = h
e.z = h
e.u = n
e.w = l
e.s = b
e.r = m
n.y = h
n.t = h
i.z = e
i.w = b
i.s = b
i.p = n
i.q = m
h.r = i
assert l.x.u.r.z.w.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: H = None
        self.y: C = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: B = None
        self.q: H = None
        self.y: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: H = None
        self.u: F = None
        self.w: C = None
        self.z: H = None
        self.s: A = None
        self.r: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: A = None
        self.p: F = None
        self.s: A = None
        self.q: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

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