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

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

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

f = A("f")
j = B("j")
i = C("i")
l = A("l")
b = B("b")
a = B("a")
c = C("c")
n = A("n")

f.t = i
f.v = i
f.p = j
j.t = b
j.w = a
j.u = n
i.p = j
l.t = i
l.v = i
l.p = a
b.t = a
b.w = a
b.u = l
a.t = j
a.w = j
a.u = f
c.p = b
n.t = i
n.v = c
n.p = b
assert j.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
i = C("i")
l = A("l")
b = B("b")
a = B("a")
c = C("c")
n = A("n")

f.t = i
f.v = i
f.p = j
j.t = b
j.w = a
j.u = n
i.p = j
l.t = i
l.v = i
l.p = a
b.t = a
b.w = a
b.u = l
a.t = j
a.w = j
a.u = f
c.p = b
n.t = i
n.v = c
n.p = b
assert j.w.t.w.txt == "a"