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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: D = None
        self.q: G = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

h.y = a
h.v = a
h.x = g
h.r = m
f.v = h
f.x = m
f.s = m
f.u = b
f.r = b
f.y = a
g.z = h
g.v = d
g.q = l
g.y = f
b.z = g
b.o = l
n.t = g
n.r = g
n.s = b
n.x = h
n.y = a
m.v = f
l.p = g
a.o = m
a.u = g
d.z = g
d.o = l
assert h.x.q.p.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: H = None
        self.v: H = None
        self.x: C = None
        self.r: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: D = None
        self.q: G = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

h.y = a
h.v = a
h.x = g
h.r = m
f.v = h
f.x = m
f.s = m
f.u = b
f.r = b
f.y = a
g.z = h
g.v = d
g.q = l
g.y = f
b.z = g
b.o = l
n.t = g
n.r = g
n.s = b
n.x = h
n.y = a
m.v = f
l.p = g
a.o = m
a.u = g
d.z = g
d.o = l
assert h.x.q.p.v.z.v.txt == "d"