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

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

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: H = None
        self.x: B = None
        self.v: A = None
        self.z: H = None
        self.o: A = None
        self.q: H = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: F = None
        self.u: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: G = None
        self.q: A = None
        self.p: E = None
        self.s: G = None
        self.y: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: H = None
        self.x: B = None
        self.v: A = None
        self.z: H = None
        self.o: A = None
        self.q: H = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: F = None
        self.u: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: G = None
        self.q: A = None
        self.p: E = None
        self.s: G = None
        self.y: D = None
        self.txt = txt

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

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