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

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

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

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

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

f = A("f")
i = B("i")
c = C("c")
k = D("k")
h = E("h")

f.y = k
f.t = i
f.v = h
i.x = h
i.o = f
i.r = k
i.t = c
i.w = c
c.q = h
c.z = h
c.t = f
c.r = f
k.y = i
k.u = i
k.z = i
k.v = f
h.w = k
h.s = k
h.y = i
assert h.y.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: B = None
        self.v: E = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
c = C("c")
k = D("k")
h = E("h")

f.y = k
f.t = i
f.v = h
i.x = h
i.o = f
i.r = k
i.t = c
i.w = c
c.q = h
c.z = h
c.t = f
c.r = f
k.y = i
k.u = i
k.z = i
k.v = f
h.w = k
h.s = k
h.y = i
assert h.y.r.v.txt == "f"