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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.w: C = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

b = A("b")
f = B("f")
d = C("d")
l = D("l")
e = E("e")
i = F("i")
h = G("h")
j = E("j")
a = E("a")
n = C("n")

b.w = f
b.x = j
b.o = i
b.p = l
f.z = b
d.q = h
d.z = a
l.w = n
e.x = i
i.u = l
h.p = f
h.v = f
h.w = d
h.x = l
h.y = l
j.x = i
a.x = i
n.q = h
n.z = j
assert h.p.z.w.z.p.w.q.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: E = None
        self.o: F = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.w: C = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

b = A("b")
f = B("f")
d = C("d")
l = D("l")
e = E("e")
i = F("i")
h = G("h")
j = E("j")
a = E("a")
n = C("n")

b.w = f
b.x = j
b.o = i
b.p = l
f.z = b
d.q = h
d.z = a
l.w = n
e.x = i
i.u = l
h.p = f
h.v = f
h.w = d
h.x = l
h.y = l
j.x = i
a.x = i
n.q = h
n.z = j
assert h.p.z.w.z.p.w.q.x.w.txt == "n"