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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: B = None
        self.x: D = None
        self.txt = txt

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

d.x = l
d.s = e
l.x = j
l.w = e
f.p = l
k.z = d
k.o = d
k.y = d
j.q = f
j.w = l
j.x = k
b.q = f
b.w = l
b.x = k
g.q = f
g.w = l
g.x = k
e.x = l
e.s = d
assert b.w.w.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: B = None
        self.x: D = None
        self.txt = txt

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

d.x = l
d.s = e
l.x = j
l.w = e
f.p = l
k.z = d
k.o = d
k.y = d
j.q = f
j.w = l
j.x = k
b.q = f
b.w = l
b.x = k
g.q = f
g.w = l
g.x = k
e.x = l
e.s = d
assert b.w.w.s.s.s.txt == "d"