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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: A = None
        self.p: C = None
        self.r: E = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.y: E = None
        self.x: E = None
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
b = C("b")
j = D("j")
g = E("g")
d = E("d")
c = A("c")

h.s = g
l.z = j
l.y = h
l.p = b
l.r = d
l.x = c
b.r = h
b.v = h
b.y = d
b.x = g
b.s = l
j.y = l
g.u = d
g.z = l
g.o = b
g.w = j
g.y = j
d.u = g
d.z = l
d.o = b
d.w = j
d.y = j
c.s = g
assert d.u.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: A = None
        self.p: C = None
        self.r: E = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: A = None
        self.y: E = None
        self.x: E = None
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
b = C("b")
j = D("j")
g = E("g")
d = E("d")
c = A("c")

h.s = g
l.z = j
l.y = h
l.p = b
l.r = d
l.x = c
b.r = h
b.v = h
b.y = d
b.x = g
b.s = l
j.y = l
g.u = d
g.z = l
g.o = b
g.w = j
g.y = j
d.u = g
d.z = l
d.o = b
d.w = j
d.y = j
c.s = g
assert d.u.o.y.txt == "d"