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

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

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

b = A("b")
e = B("e")
i = C("i")
f = C("f")
k = C("k")
a = B("a")
n = C("n")
m = A("m")
d = A("d")

b.r = f
b.v = m
b.x = d
e.q = f
e.y = k
e.p = a
i.v = f
i.t = n
i.q = k
f.v = i
f.t = i
f.q = i
k.v = i
k.t = n
k.q = n
a.q = n
a.y = k
a.p = e
n.v = k
n.q = k
n.t = f
m.r = k
m.v = b
m.x = b
d.r = k
d.v = b
d.x = m
assert f.q.q.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.x: A = None
        self.txt = txt

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

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

b = A("b")
e = B("e")
i = C("i")
f = C("f")
k = C("k")
a = B("a")
n = C("n")
m = A("m")
d = A("d")

b.r = f
b.v = m
b.x = d
e.q = f
e.y = k
e.p = a
i.v = f
i.t = n
i.q = k
f.v = i
f.t = i
f.q = i
k.v = i
k.t = n
k.q = n
a.q = n
a.y = k
a.p = e
n.v = k
n.q = k
n.t = f
m.r = k
m.v = b
m.x = b
d.r = k
d.v = b
d.x = m
assert f.q.q.t.t.txt == "f"