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

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

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

c = A("c")
f = B("f")
n = C("n")
d = B("d")
k = A("k")
l = C("l")
a = B("a")

c.r = d
f.r = k
f.u = k
f.p = a
n.y = a
n.v = a
n.t = l
d.r = k
d.p = f
d.u = c
k.r = a
l.y = d
l.v = d
l.t = n
a.r = c
a.p = d
a.u = k
assert k.r.r.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
n = C("n")
d = B("d")
k = A("k")
l = C("l")
a = B("a")

c.r = d
f.r = k
f.u = k
f.p = a
n.y = a
n.v = a
n.t = l
d.r = k
d.p = f
d.u = c
k.r = a
l.y = d
l.v = d
l.t = n
a.r = c
a.p = d
a.u = k
assert k.r.r.r.u.txt == "c"