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

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

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

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

i = A("i")
m = B("m")
k = C("k")
e = D("e")
f = C("f")
b = D("b")
c = B("c")

i.o = b
i.y = e
m.q = i
m.v = e
k.v = e
k.p = i
k.w = f
e.s = i
e.z = i
f.v = e
f.p = i
f.w = k
b.s = i
b.z = i
c.q = i
c.v = e
assert f.v.z.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: D = None
        self.txt = txt

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

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

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

i = A("i")
m = B("m")
k = C("k")
e = D("e")
f = C("f")
b = D("b")
c = B("c")

i.o = b
i.y = e
m.q = i
m.v = e
k.v = e
k.p = i
k.w = f
e.s = i
e.z = i
f.v = e
f.p = i
f.w = k
b.s = i
b.z = i
c.q = i
c.v = e
assert f.v.z.o.z.o.txt == "b"