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

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: H = None
        self.q: D = None
        self.p: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.v: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: C = None
        self.o: G = None
        self.y: C = None
        self.u: H = None
        self.s: G = None
        self.t: G = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: H = None
        self.q: D = None
        self.p: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.z: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.v: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: C = None
        self.o: G = None
        self.y: C = None
        self.u: H = None
        self.s: G = None
        self.t: G = None
        self.txt = txt

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

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