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

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

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

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

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

f = A("f")
k = B("k")
h = C("h")
m = D("m")
d = E("d")
c = A("c")
j = C("j")

f.y = j
f.v = j
f.t = d
k.w = d
k.x = f
h.z = k
m.v = j
m.s = f
m.z = k
d.u = k
c.y = h
c.v = j
c.t = d
j.z = k
assert c.v.z.w.u.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

f = A("f")
k = B("k")
h = C("h")
m = D("m")
d = E("d")
c = A("c")
j = C("j")

f.y = j
f.v = j
f.t = d
k.w = d
k.x = f
h.z = k
m.v = j
m.s = f
m.z = k
d.u = k
c.y = h
c.v = j
c.t = d
j.z = k
assert c.v.z.w.u.x.y.txt == "j"