class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: H = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: E = None
        self.r: B = None
        self.o: A = None
        self.t: H = None
        self.s: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: F = None
        self.s: G = None
        self.x: F = None
        self.z: F = None
        self.o: D = None
        self.y: C = None
        self.p: F = None
        self.txt = txt

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

c.o = b
b.z = n
b.q = n
n.p = c
l.v = c
l.s = m
l.y = b
a.p = d
a.t = d
h.y = n
h.u = a
h.r = b
h.s = b
h.o = c
h.t = m
d.y = l
d.o = a
m.r = l
m.o = l
m.w = h
m.x = h
m.z = h
m.p = h
m.s = d
m.y = n
assert d.y.y.z.p.o.q.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: H = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: E = None
        self.r: B = None
        self.o: A = None
        self.t: H = None
        self.s: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: F = None
        self.s: G = None
        self.x: F = None
        self.z: F = None
        self.o: D = None
        self.y: C = None
        self.p: F = None
        self.txt = txt

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

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