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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: A = None
        self.v: C = None
        self.x: B = None
        self.z: E = None
        self.o: B = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: C = None
        self.txt = txt

m = A("m")
b = B("b")
a = C("a")
d = D("d")
l = E("l")
h = F("h")
k = G("k")
i = F("i")
f = C("f")

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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: A = None
        self.v: C = None
        self.x: B = None
        self.z: E = None
        self.o: B = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: C = None
        self.txt = txt

m = A("m")
b = B("b")
a = C("a")
d = D("d")
l = E("l")
h = F("h")
k = G("k")
i = F("i")
f = C("f")

m.q = b
m.z = d
m.s = k
b.p = h
b.x = d
a.w = m
a.q = m
a.v = f
a.x = b
a.o = b
a.z = l
a.p = i
d.t = l
l.v = b
l.r = h
h.q = k
h.o = b
k.u = l
k.q = f
i.q = k
i.o = b
f.w = m
f.q = m
f.v = a
f.x = b
f.o = b
f.z = l
f.p = i
assert l.r.q.q.w.q.p.o.txt == "b"