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

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

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

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

f = A("f")
i = B("i")
e = C("e")
n = D("n")
m = D("m")
l = C("l")
g = B("g")
k = D("k")
h = A("h")

f.u = h
f.w = h
f.t = g
f.q = e
i.z = h
i.y = h
i.s = n
e.s = f
e.t = l
n.s = h
n.v = e
m.s = f
m.v = e
l.s = f
l.t = e
g.z = f
g.y = f
g.s = m
k.s = f
k.v = e
h.u = f
h.w = f
h.t = g
h.q = e
assert n.v.t.t.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.w: A = None
        self.q: C = None
        self.txt = txt

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

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

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

f = A("f")
i = B("i")
e = C("e")
n = D("n")
m = D("m")
l = C("l")
g = B("g")
k = D("k")
h = A("h")

f.u = h
f.w = h
f.t = g
f.q = e
i.z = h
i.y = h
i.s = n
e.s = f
e.t = l
n.s = h
n.v = e
m.s = f
m.v = e
l.s = f
l.t = e
g.z = f
g.y = f
g.s = m
k.s = f
k.v = e
h.u = f
h.w = f
h.t = g
h.q = e
assert n.v.t.t.s.q.txt == "e"