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

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

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

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

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

g = A("g")
n = B("n")
f = C("f")
a = D("a")
l = E("l")
k = B("k")

g.w = l
n.y = g
f.q = l
f.s = l
f.w = l
f.v = k
a.x = k
a.t = g
l.p = f
k.y = g
assert f.s.p.v.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

g = A("g")
n = B("n")
f = C("f")
a = D("a")
l = E("l")
k = B("k")

g.w = l
n.y = g
f.q = l
f.s = l
f.w = l
f.v = k
a.x = k
a.t = g
l.p = f
k.y = g
assert f.s.p.v.y.w.txt == "l"