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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: F = None
        self.p: E = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: A = None
        self.p: G = None
        self.r: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: C = None
        self.r: C = None
        self.t: B = None
        self.o: F = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

e = A("e")
h = B("h")
b = C("b")
g = D("g")
i = E("i")
d = F("d")
c = G("c")

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: F = None
        self.p: E = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: A = None
        self.p: G = None
        self.r: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: C = None
        self.r: C = None
        self.t: B = None
        self.o: F = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

e = A("e")
h = B("h")
b = C("b")
g = D("g")
i = E("i")
d = F("d")
c = G("c")

e.w = h
h.w = b
h.t = d
h.p = i
h.u = g
b.z = g
b.t = e
b.p = c
b.r = i
g.o = i
g.q = b
i.u = c
i.o = b
i.z = h
d.v = i
d.r = i
d.q = e
d.y = e
d.w = b
d.p = c
c.q = e
c.y = b
c.r = b
c.t = h
c.u = h
c.o = d
c.w = i
assert h.t.r.u.w.u.q.w.txt == "h"