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

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

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

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

n.p = i
n.r = i
n.s = c
i.t = e
i.x = j
e.w = i
e.t = i
e.v = c
c.w = i
c.t = i
c.v = e
j.p = i
j.r = i
j.s = c
assert c.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: B = None
        self.s: C = None
        self.txt = txt

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

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

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

n.p = i
n.r = i
n.s = c
i.t = e
i.x = j
e.w = i
e.t = i
e.v = c
c.w = i
c.t = i
c.v = e
j.p = i
j.r = i
j.s = c
assert c.v.v.v.txt == "e"