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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: G = None
        self.s: D = None
        self.z: F = None
        self.t: G = None
        self.p: G = None
        self.y: C = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: A = None
        self.z: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: C = None
        self.o: B = None
        self.q: C = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: G = None
        self.s: D = None
        self.z: F = None
        self.t: G = None
        self.p: G = None
        self.y: C = None
        self.w: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: A = None
        self.z: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: C = None
        self.o: B = None
        self.q: C = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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