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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: F = None
        self.o: D = None
        self.s: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: F = None
        self.o: D = None
        self.s: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

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

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

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