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

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

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

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

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

g = A("g")
d = B("d")
n = C("n")
h = D("h")
i = E("i")
b = E("b")
f = D("f")
m = A("m")

g.s = f
g.u = m
g.p = d
g.t = n
d.p = m
d.s = n
d.w = h
n.t = d
h.v = n
i.z = h
i.y = n
b.z = h
b.y = n
f.v = n
m.s = f
m.u = g
m.p = d
m.t = n
assert f.v.t.s.t.p.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: A = None
        self.p: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

g = A("g")
d = B("d")
n = C("n")
h = D("h")
i = E("i")
b = E("b")
f = D("f")
m = A("m")

g.s = f
g.u = m
g.p = d
g.t = n
d.p = m
d.s = n
d.w = h
n.t = d
h.v = n
i.z = h
i.y = n
b.z = h
b.y = n
f.v = n
m.s = f
m.u = g
m.p = d
m.t = n
assert f.v.t.s.t.p.u.p.s.txt == "n"