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

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

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

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

l = A("l")
f = B("f")
d = C("d")
i = D("i")
a = D("a")
n = B("n")
e = A("e")
g = C("g")

l.t = a
f.y = i
d.s = g
d.p = n
i.w = a
i.u = d
a.w = i
a.u = d
n.y = i
e.t = i
g.s = d
g.p = f
assert d.s.s.s.s.s.p.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
d = C("d")
i = D("i")
a = D("a")
n = B("n")
e = A("e")
g = C("g")

l.t = a
f.y = i
d.s = g
d.p = n
i.w = a
i.u = d
a.w = i
a.u = d
n.y = i
e.t = i
g.s = d
g.p = f
assert d.s.s.s.s.s.p.y.u.txt == "d"