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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: C = None
        self.v: B = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
e = C("e")
c = D("c")
k = E("k")
f = C("f")
g = E("g")
h = B("h")
d = D("d")

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: C = None
        self.v: B = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
e = C("e")
c = D("c")
k = E("k")
f = C("f")
g = E("g")
h = B("h")
d = D("d")

l.r = k
b.o = c
b.q = e
b.v = h
b.y = g
e.o = k
c.w = h
c.z = l
c.p = l
c.s = b
c.u = g
k.s = c
k.p = b
f.o = k
g.s = c
g.p = b
h.o = d
h.q = e
h.v = b
h.y = g
d.w = b
d.z = l
d.p = l
d.s = h
d.u = k
assert l.r.p.v.o.u.p.txt == "b"