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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.u: C = None
        self.p: C = None
        self.z: B = None
        self.v: B = None
        self.x: C = None
        self.o: B = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
k = C("k")
i = D("i")
e = E("e")
c = F("c")
l = G("l")
j = H("j")
d = E("d")

m.q = b
m.p = b
b.p = i
k.p = c
i.q = m
i.r = b
i.z = b
i.v = b
i.o = b
i.u = k
i.p = k
i.x = k
e.o = m
e.x = k
c.s = b
c.o = d
c.q = i
l.p = j
j.t = e
j.v = e
j.x = d
j.o = c
j.r = c
d.o = m
d.x = k
assert c.s.p.r.p.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.u: C = None
        self.p: C = None
        self.z: B = None
        self.v: B = None
        self.x: C = None
        self.o: B = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
k = C("k")
i = D("i")
e = E("e")
c = F("c")
l = G("l")
j = H("j")
d = E("d")

m.q = b
m.p = b
b.p = i
k.p = c
i.q = m
i.r = b
i.z = b
i.v = b
i.o = b
i.u = k
i.p = k
i.x = k
e.o = m
e.x = k
c.s = b
c.o = d
c.q = i
l.p = j
j.t = e
j.v = e
j.x = d
j.o = c
j.r = c
d.o = m
d.x = k
assert c.s.p.r.p.q.q.txt == "b"