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

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

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

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

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

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

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

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

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