class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: F = None
        self.r: G = None
        self.t: H = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: G = None
        self.t: F = None
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: A = None
        self.v: H = None
        self.r: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.p: E = None
        self.o: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: F = None
        self.r: G = None
        self.t: H = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: G = None
        self.t: F = None
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: A = None
        self.v: H = None
        self.r: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.p: E = None
        self.o: B = None
        self.txt = txt

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

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