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

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

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

n = A("n")
a = B("a")
d = C("d")
j = C("j")

n.v = d
n.t = a
a.w = j
a.o = d
d.r = j
d.u = a
j.r = d
j.u = a
assert d.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: B = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
d = C("d")
j = C("j")

n.v = d
n.t = a
a.w = j
a.o = d
d.r = j
d.u = a
j.r = d
j.u = a
assert d.u.w.u.txt == "a"