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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: G = None
        self.u: H = None
        self.p: F = None
        self.w: F = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: B = None
        self.r: B = None
        self.p: G = None
        self.o: E = None
        self.v: H = None
        self.t: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: H = None
        self.t: B = None
        self.w: F = None
        self.q: D = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: G = None
        self.u: H = None
        self.p: F = None
        self.w: F = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: B = None
        self.r: B = None
        self.p: G = None
        self.o: E = None
        self.v: H = None
        self.t: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: H = None
        self.t: B = None
        self.w: F = None
        self.q: D = None
        self.txt = txt

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

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

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