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

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: B = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

i = A("i")
k = B("k")
b = C("b")
d = D("d")
e = E("e")
f = D("f")
n = A("n")
a = B("a")

i.z = f
k.q = f
k.o = a
b.z = i
b.p = n
d.w = f
d.r = k
d.q = i
d.o = b
e.x = a
e.z = n
e.s = i
f.w = d
f.r = a
f.q = n
f.o = b
n.z = d
a.q = d
a.o = k
assert i.z.w.q.z.r.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: B = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

i = A("i")
k = B("k")
b = C("b")
d = D("d")
e = E("e")
f = D("f")
n = A("n")
a = B("a")

i.z = f
k.q = f
k.o = a
b.z = i
b.p = n
d.w = f
d.r = k
d.q = i
d.o = b
e.x = a
e.z = n
e.s = i
f.w = d
f.r = a
f.q = n
f.o = b
n.z = d
a.q = d
a.o = k
assert i.z.w.q.z.r.o.o.txt == "a"