class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: E = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: H = None
        self.v: D = None
        self.w: F = None
        self.txt = txt

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

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

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

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

g.s = k
g.u = b
g.v = l
n.q = l
n.w = l
n.y = m
n.t = g
k.u = g
l.y = g
l.s = g
l.o = d
b.u = n
b.s = e
b.v = l
b.w = m
m.y = l
m.o = g
m.p = b
m.w = b
m.u = k
d.q = n
e.s = l
e.z = d
assert n.w.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: E = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: H = None
        self.v: D = None
        self.w: F = None
        self.txt = txt

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

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

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

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

g.s = k
g.u = b
g.v = l
n.q = l
n.w = l
n.y = m
n.t = g
k.u = g
l.y = g
l.s = g
l.o = d
b.u = n
b.s = e
b.v = l
b.w = m
m.y = l
m.o = g
m.p = b
m.w = b
m.u = k
d.q = n
e.s = l
e.z = d
assert n.w.o.q.txt == "n"