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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: A = None
        self.x: C = None
        self.z: E = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
i = C("i")
m = D("m")
j = E("j")
f = D("f")
d = C("d")
a = D("a")
l = E("l")

c.p = j
e.w = j
e.z = j
e.u = c
e.x = d
i.u = c
m.v = j
j.z = c
j.y = e
f.v = l
d.u = c
a.v = j
l.z = c
l.y = e
assert f.v.y.z.z.p.y.w.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: A = None
        self.x: C = None
        self.z: E = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
i = C("i")
m = D("m")
j = E("j")
f = D("f")
d = C("d")
a = D("a")
l = E("l")

c.p = j
e.w = j
e.z = j
e.u = c
e.x = d
i.u = c
m.v = j
j.z = c
j.y = e
f.v = l
d.u = c
a.v = j
l.z = c
l.y = e
assert f.v.y.z.z.p.y.w.y.u.txt == "c"