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

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: C = None
        self.v: C = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: C = None
        self.v: C = None
        self.q: E = None
        self.txt = txt

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

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

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

b.r = d
k.p = h
k.v = d
f.z = a
f.t = a
f.v = a
f.q = e
g.o = e
g.t = l
d.s = e
d.y = b
a.z = f
a.t = f
a.v = f
a.q = e
h.p = k
h.v = e
i.r = d
l.o = e
l.t = g
e.s = d
e.y = i
assert l.o.y.r.txt == "d"