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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: H = None
        self.t: B = None
        self.y: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

n.s = h
n.x = d
n.q = b
n.o = b
n.v = g
n.t = g
e.o = b
e.t = m
d.t = e
c.x = g
c.y = d
g.q = c
g.y = b
h.s = c
h.x = b
h.y = b
h.t = e
m.r = n
b.s = c
b.u = c
b.v = m
b.y = g
b.x = h
assert h.t.o.u.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: C = None
        self.q: H = None
        self.v: E = None
        self.o: H = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: H = None
        self.t: B = None
        self.y: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

n.s = h
n.x = d
n.q = b
n.o = b
n.v = g
n.t = g
e.o = b
e.t = m
d.t = e
c.x = g
c.y = d
g.q = c
g.y = b
h.s = c
h.x = b
h.y = b
h.t = e
m.r = n
b.s = c
b.u = c
b.v = m
b.y = g
b.x = h
assert h.t.o.u.x.q.txt == "c"