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

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

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

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

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

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

j.x = b
g.y = b
g.r = f
g.t = f
b.u = n
n.s = b
n.w = j
f.y = b
i.y = b
i.r = f
i.t = f
assert i.t.y.u.s.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

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

j.x = b
g.y = b
g.r = f
g.t = f
b.u = n
n.s = b
n.w = j
f.y = b
i.y = b
i.r = f
i.t = f
assert i.t.y.u.s.u.w.txt == "j"