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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: G = None
        self.q: A = None
        self.o: D = None
        self.r: E = None
        self.x: C = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: G = None
        self.q: A = None
        self.o: D = None
        self.r: E = None
        self.x: C = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

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

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