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

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

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

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

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

h = A("h")
f = B("f")
i = C("i")
e = D("e")
c = E("c")
b = B("b")
l = E("l")

h.y = i
h.v = e
h.r = c
f.y = h
i.v = e
e.v = i
e.w = b
c.u = e
c.w = b
b.y = h
l.u = e
l.w = f
assert c.u.w.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: D = None
        self.r: E = None
        self.txt = txt

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

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

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

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

h = A("h")
f = B("f")
i = C("i")
e = D("e")
c = E("c")
b = B("b")
l = E("l")

h.y = i
h.v = e
h.r = c
f.y = h
i.v = e
e.v = i
e.w = b
c.u = e
c.w = b
b.y = h
l.u = e
l.w = f
assert c.u.w.y.y.txt == "i"