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

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

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

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

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

d = A("d")
g = B("g")
f = C("f")
b = D("b")
l = E("l")

d.s = f
g.r = l
f.o = g
b.o = f
b.u = l
l.z = g
l.w = g
assert g.r.w.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

d = A("d")
g = B("g")
f = C("f")
b = D("b")
l = E("l")

d.s = f
g.r = l
f.o = g
b.o = f
b.u = l
l.z = g
l.w = g
assert g.r.w.r.w.txt == "g"