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

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

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

a = A("a")
d = B("d")
k = C("k")
c = C("c")
b = A("b")
j = A("j")
g = C("g")

a.x = d
a.u = d
d.v = j
k.t = d
k.s = d
k.q = j
c.t = d
c.s = d
c.q = j
b.x = d
b.u = d
j.x = d
j.u = d
g.t = d
g.s = d
g.q = b
assert g.q.u.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: B = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
k = C("k")
c = C("c")
b = A("b")
j = A("j")
g = C("g")

a.x = d
a.u = d
d.v = j
k.t = d
k.s = d
k.q = j
c.t = d
c.s = d
c.q = j
b.x = d
b.u = d
j.x = d
j.u = d
g.t = d
g.s = d
g.q = b
assert g.q.u.v.x.v.txt == "j"