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

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

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

d = A("d")
j = B("j")
n = C("n")
g = A("g")
i = B("i")

d.x = i
d.o = n
j.v = i
j.y = i
j.t = i
n.v = i
g.x = j
g.o = n
i.v = j
i.y = j
i.t = j
assert d.o.v.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.txt = txt

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

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

d = A("d")
j = B("j")
n = C("n")
g = A("g")
i = B("i")

d.x = i
d.o = n
j.v = i
j.y = i
j.t = i
n.v = i
g.x = j
g.o = n
i.v = j
i.y = j
i.t = j
assert d.o.v.t.t.txt == "i"