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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.x: A = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.w: H = None
        self.x: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: E = None
        self.x: A = None
        self.u: C = None
        self.txt = txt

b = A("b")
n = B("n")
a = C("a")
g = D("g")
e = E("e")
k = F("k")
i = G("i")
c = H("c")

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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.x: A = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.w: H = None
        self.x: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: E = None
        self.x: A = None
        self.u: C = None
        self.txt = txt

b = A("b")
n = B("n")
a = C("a")
g = D("g")
e = E("e")
k = F("k")
i = G("i")
c = H("c")

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