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

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

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

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

g = A("g")
m = B("m")
j = C("j")
e = D("e")
l = A("l")
k = A("k")

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

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

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

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

g = A("g")
m = B("m")
j = C("j")
e = D("e")
l = A("l")
k = A("k")

g.r = m
m.s = e
m.z = e
j.o = m
j.w = e
j.z = e
e.t = m
e.s = l
e.w = l
l.r = m
k.r = m
assert e.w.r.s.w.r.z.txt == "e"