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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: H = None
        self.p: A = None
        self.y: B = None
        self.q: H = None
        self.x: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: D = None
        self.z: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: A = None
        self.o: F = None
        self.v: A = None
        self.txt = txt

h = A("h")
f = B("f")
j = C("j")
n = D("n")
d = E("d")
b = F("b")
c = G("c")
e = H("e")

h.r = e
f.x = c
j.o = h
j.u = c
j.p = b
n.s = h
n.y = h
n.w = c
n.r = c
n.u = d
n.z = j
n.v = b
d.u = e
d.s = e
d.q = e
d.p = h
d.x = h
d.y = f
b.w = n
b.x = n
b.z = e
c.s = h
c.w = b
e.y = f
e.x = h
e.v = h
e.o = b
assert f.x.w.z.y.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: H = None
        self.p: A = None
        self.y: B = None
        self.q: H = None
        self.x: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: D = None
        self.z: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: A = None
        self.o: F = None
        self.v: A = None
        self.txt = txt

h = A("h")
f = B("f")
j = C("j")
n = D("n")
d = E("d")
b = F("b")
c = G("c")
e = H("e")

h.r = e
f.x = c
j.o = h
j.u = c
j.p = b
n.s = h
n.y = h
n.w = c
n.r = c
n.u = d
n.z = j
n.v = b
d.u = e
d.s = e
d.q = e
d.p = h
d.x = h
d.y = f
b.w = n
b.x = n
b.z = e
c.s = h
c.w = b
e.y = f
e.x = h
e.v = h
e.o = b
assert f.x.w.z.y.x.s.txt == "h"