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

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

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

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

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

b = A("b")
n = B("n")
h = C("h")
e = D("e")
i = E("i")

b.w = n
b.x = i
b.s = h
n.w = i
n.x = i
h.u = n
e.v = n
i.y = h
i.p = h
i.t = n
assert b.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: E = None
        self.s: C = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
h = C("h")
e = D("e")
i = E("i")

b.w = n
b.x = i
b.s = h
n.w = i
n.x = i
h.u = n
e.v = n
i.y = h
i.p = h
i.t = n
assert b.x.t.x.txt == "i"