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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: B = None
        self.w: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
n = C("n")
m = D("m")
b = C("b")
l = A("l")
f = D("f")
g = C("g")
d = B("d")

e.s = d
e.o = d
j.o = d
j.p = d
j.w = d
n.v = m
m.p = n
m.t = n
m.r = d
m.z = f
b.v = f
l.s = d
l.o = j
f.p = g
f.r = d
f.z = m
f.t = b
g.v = m
d.o = j
d.p = j
d.w = j
assert e.o.w.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: B = None
        self.w: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
n = C("n")
m = D("m")
b = C("b")
l = A("l")
f = D("f")
g = C("g")
d = B("d")

e.s = d
e.o = d
j.o = d
j.p = d
j.w = d
n.v = m
m.p = n
m.t = n
m.r = d
m.z = f
b.v = f
l.s = d
l.o = j
f.p = g
f.r = d
f.z = m
f.t = b
g.v = m
d.o = j
d.p = j
d.w = j
assert e.o.w.o.o.o.o.txt == "j"