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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: D = None
        self.v: D = None
        self.p: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: D = None
        self.v: D = None
        self.p: A = None
        self.txt = txt

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

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

f.u = h
i.w = l
i.u = l
i.s = n
e.r = n
e.u = c
e.v = h
e.p = f
h.y = i
a.u = c
g.w = i
g.u = l
g.s = n
c.y = l
l.w = g
l.u = g
l.s = f
n.u = c
assert g.s.u.y.w.u.s.u.y.u.txt == "l"