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

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

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

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

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

b = A("b")
k = B("k")
d = C("d")
f = D("f")
i = E("i")
a = E("a")

b.r = i
k.x = d
k.u = b
d.o = k
d.y = f
f.v = k
f.t = i
i.o = b
i.t = a
i.r = a
a.o = b
a.t = i
a.r = i
assert d.y.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

b = A("b")
k = B("k")
d = C("d")
f = D("f")
i = E("i")
a = E("a")

b.r = i
k.x = d
k.u = b
d.o = k
d.y = f
f.v = k
f.t = i
i.o = b
i.t = a
i.r = a
a.o = b
a.t = i
a.r = i
assert d.y.t.o.txt == "b"