class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.p: E = None
        self.r: D = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: F = None
        self.w: E = None
        self.q: F = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: D = None
        self.v: H = None
        self.p: E = None
        self.r: G = None
        self.u: G = None
        self.s: B = None
        self.txt = txt

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

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

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

d.u = n
d.p = h
d.r = b
d.x = f
l.r = g
l.y = f
l.q = f
l.w = h
l.x = d
m.o = f
b.p = n
b.w = n
b.q = d
b.u = g
b.z = g
h.w = m
f.o = b
f.q = b
f.v = n
f.p = h
f.r = g
f.u = g
f.s = l
g.z = m
g.r = n
n.w = h
n.u = h
n.v = l
assert n.u.w.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.p: E = None
        self.r: D = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: F = None
        self.w: E = None
        self.q: F = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: D = None
        self.v: H = None
        self.p: E = None
        self.r: G = None
        self.u: G = None
        self.s: B = None
        self.txt = txt

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

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

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

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