class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: E = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.s: G = None
        self.t: F = None
        self.z: A = None
        self.v: B = None
        self.y: G = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.w: G = None
        self.txt = txt

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

n = A("n")
g = B("g")
c = C("c")
a = D("a")
i = E("i")
l = F("l")
h = G("h")
m = D("m")

n.t = h
n.y = i
n.p = i
g.x = h
c.w = m
a.s = l
i.x = h
i.s = h
i.y = h
i.t = l
i.z = n
i.p = n
i.v = g
l.q = g
l.t = m
l.w = h
h.q = m
h.s = c
h.z = c
h.o = i
m.s = l
assert a.s.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: E = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.s: G = None
        self.t: F = None
        self.z: A = None
        self.v: B = None
        self.y: G = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.w: G = None
        self.txt = txt

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

n = A("n")
g = B("g")
c = C("c")
a = D("a")
i = E("i")
l = F("l")
h = G("h")
m = D("m")

n.t = h
n.y = i
n.p = i
g.x = h
c.w = m
a.s = l
i.x = h
i.s = h
i.y = h
i.t = l
i.z = n
i.p = n
i.v = g
l.q = g
l.t = m
l.w = h
h.q = m
h.s = c
h.z = c
h.o = i
m.s = l
assert a.s.q.x.txt == "h"