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

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

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

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

n = A("n")
j = B("j")
g = C("g")
k = D("k")
b = B("b")
f = D("f")
i = C("i")
h = C("h")
d = C("d")

n.s = d
n.w = f
n.o = g
j.q = b
g.o = k
k.r = j
k.o = g
k.z = f
b.q = j
f.r = j
f.o = d
f.z = k
i.o = f
h.o = f
d.o = f
assert g.o.z.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: D = None
        self.o: C = None
        self.txt = txt

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

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

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

n = A("n")
j = B("j")
g = C("g")
k = D("k")
b = B("b")
f = D("f")
i = C("i")
h = C("h")
d = C("d")

n.s = d
n.w = f
n.o = g
j.q = b
g.o = k
k.r = j
k.o = g
k.z = f
b.q = j
f.r = j
f.o = d
f.z = k
i.o = f
h.o = f
d.o = f
assert g.o.z.o.o.o.o.txt == "f"