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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: E = None
        self.v: B = None
        self.txt = txt

c = A("c")
b = B("b")
l = C("l")
g = D("g")
d = E("d")
h = F("h")
m = G("m")
n = H("n")

c.w = m
c.u = n
c.p = g
c.y = l
b.u = g
b.s = g
l.t = h
l.v = g
l.y = g
g.u = n
g.p = n
g.x = m
d.s = l
d.y = b
h.r = d
h.p = g
h.v = g
h.w = c
m.w = h
m.z = g
m.p = n
n.r = b
n.v = b
n.s = d
assert h.p.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.u: H = None
        self.p: D = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: E = None
        self.v: B = None
        self.txt = txt

c = A("c")
b = B("b")
l = C("l")
g = D("g")
d = E("d")
h = F("h")
m = G("m")
n = H("n")

c.w = m
c.u = n
c.p = g
c.y = l
b.u = g
b.s = g
l.t = h
l.v = g
l.y = g
g.u = n
g.p = n
g.x = m
d.s = l
d.y = b
h.r = d
h.p = g
h.v = g
h.w = c
m.w = h
m.z = g
m.p = n
n.r = b
n.v = b
n.s = d
assert h.p.x.z.txt == "g"