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

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

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

f = A("f")
e = B("e")
c = C("c")
i = B("i")
k = A("k")
j = A("j")

f.s = c
e.v = c
e.u = f
c.r = k
c.p = e
c.s = i
i.v = c
i.u = j
k.s = c
j.s = c
assert e.u.s.s.u.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
c = C("c")
i = B("i")
k = A("k")
j = A("j")

f.s = c
e.v = c
e.u = f
c.r = k
c.p = e
c.s = i
i.v = c
i.u = j
k.s = c
j.s = c
assert e.u.s.s.u.s.p.txt == "e"