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

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

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

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

g = A("g")
i = B("i")
n = C("n")
b = D("b")
h = C("h")
k = B("k")
d = A("d")
a = A("a")
e = C("e")

g.u = e
g.s = i
i.s = g
i.v = b
i.x = b
n.y = h
n.r = b
b.y = i
b.z = i
b.s = k
h.y = e
h.r = b
k.s = g
k.v = b
k.x = b
d.u = n
d.s = i
a.u = e
a.s = k
e.y = h
e.r = b
assert g.s.v.s.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: B = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
n = C("n")
b = D("b")
h = C("h")
k = B("k")
d = A("d")
a = A("a")
e = C("e")

g.u = e
g.s = i
i.s = g
i.v = b
i.x = b
n.y = h
n.r = b
b.y = i
b.z = i
b.s = k
h.y = e
h.r = b
k.s = g
k.v = b
k.x = b
d.u = n
d.s = i
a.u = e
a.s = k
e.y = h
e.r = b
assert g.s.v.s.s.u.txt == "e"