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

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

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

c = A("c")
k = B("k")
a = C("a")
j = B("j")
i = C("i")

c.p = i
c.t = a
k.p = c
k.u = j
a.p = k
a.u = i
j.p = c
j.u = k
i.p = j
i.u = a
assert j.p.p.u.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.txt = txt

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

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

c = A("c")
k = B("k")
a = C("a")
j = B("j")
i = C("i")

c.p = i
c.t = a
k.p = c
k.u = j
a.p = k
a.u = i
j.p = c
j.u = k
i.p = j
i.u = a
assert j.p.p.u.p.p.txt == "c"