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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.w: B = 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.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

i = A("i")
f = B("f")
g = C("g")
j = D("j")
k = E("k")
b = B("b")

i.r = f
f.r = g
f.v = i
f.w = b
g.u = i
j.y = k
k.o = g
b.r = g
b.v = i
b.w = f
assert j.y.o.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.w: B = 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.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

i = A("i")
f = B("f")
g = C("g")
j = D("j")
k = E("k")
b = B("b")

i.r = f
f.r = g
f.v = i
f.w = b
g.u = i
j.y = k
k.o = g
b.r = g
b.v = i
b.w = f
assert j.y.o.u.r.txt == "f"