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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

f = A("f")
k = B("k")
n = C("n")
m = D("m")
l = E("l")
d = E("d")
j = E("j")

f.x = m
f.w = j
f.t = n
k.t = d
k.v = d
n.t = m
m.w = d
l.r = f
d.r = f
j.r = f
assert d.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: E = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

f = A("f")
k = B("k")
n = C("n")
m = D("m")
l = E("l")
d = E("d")
j = E("j")

f.x = m
f.w = j
f.t = n
k.t = d
k.v = d
n.t = m
m.w = d
l.r = f
d.r = f
j.r = f
assert d.r.w.r.txt == "f"