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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: D = None
        self.y: 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.r: F = None
        self.q: G = None
        self.u: B = None
        self.z: G = None
        self.o: G = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: D = None
        self.y: 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.r: F = None
        self.q: G = None
        self.u: B = None
        self.z: G = None
        self.o: G = None
        self.txt = txt

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

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

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

l.x = d
l.s = m
d.y = g
g.z = m
g.q = n
g.y = k
n.t = m
m.r = k
m.q = b
m.z = b
m.o = b
m.u = d
k.o = m
k.t = b
b.y = m
b.p = d
assert k.o.r.o.o.p.y.q.txt == "n"