class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

j.o = c
i.x = l
i.y = j
l.o = j
l.w = h
l.u = c
l.q = c
l.r = b
c.s = i
f.z = b
h.z = d
b.x = l
b.y = j
g.z = b
m.z = d
d.x = l
d.y = j
assert l.r.x.w.z.y.o.s.y.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

j.o = c
i.x = l
i.y = j
l.o = j
l.w = h
l.u = c
l.q = c
l.r = b
c.s = i
f.z = b
h.z = d
b.x = l
b.y = j
g.z = b
m.z = d
d.x = l
d.y = j
assert l.r.x.w.z.y.o.s.y.o.s.txt == "i"