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

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

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

c = A("c")
l = B("l")
e = C("e")
n = B("n")
i = C("i")

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

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

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

c = A("c")
l = B("l")
e = C("e")
n = B("n")
i = C("i")

c.r = l
c.x = i
c.w = i
l.w = e
l.y = n
l.x = i
e.p = c
e.y = c
e.u = c
n.w = i
n.x = i
n.y = l
i.p = c
i.y = c
i.u = c
assert c.x.u.r.x.p.txt == "c"