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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

m.y = i
m.w = i
m.u = d
e.x = i
e.p = i
e.u = d
g.w = d
g.p = m
g.u = c
k.x = d
k.t = g
h.w = i
h.t = k
h.o = g
d.w = g
d.t = m
d.x = m
d.o = c
d.z = h
i.z = k
c.p = e
assert g.u.p.x.z.txt == "k"