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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: D = None
        self.p: C = None
        self.txt = txt

l = A("l")
n = B("n")
d = C("d")
j = D("j")
h = E("h")
f = E("f")
i = C("i")

l.y = f
l.w = h
l.q = h
n.o = h
n.s = j
d.t = n
d.p = i
d.v = i
d.r = h
j.w = d
j.u = l
h.v = l
h.z = j
h.p = i
f.v = l
f.z = j
f.p = d
i.t = n
i.p = d
i.v = d
i.r = h
assert n.o.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: E = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: D = None
        self.p: C = None
        self.txt = txt

l = A("l")
n = B("n")
d = C("d")
j = D("j")
h = E("h")
f = E("f")
i = C("i")

l.y = f
l.w = h
l.q = h
n.o = h
n.s = j
d.t = n
d.p = i
d.v = i
d.r = h
j.w = d
j.u = l
h.v = l
h.z = j
h.p = i
f.v = l
f.z = j
f.p = d
i.t = n
i.p = d
i.v = d
i.r = h
assert n.o.v.y.txt == "f"