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

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

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

i = A("i")
k = B("k")
m = C("m")
j = B("j")
b = C("b")
g = C("g")
l = B("l")

i.x = b
k.z = l
k.v = j
k.w = i
m.u = k
m.q = k
j.z = k
j.v = l
j.w = i
b.u = l
b.q = l
g.u = k
g.q = j
l.z = j
l.v = k
l.w = i
assert l.w.x.u.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
m = C("m")
j = B("j")
b = C("b")
g = C("g")
l = B("l")

i.x = b
k.z = l
k.v = j
k.w = i
m.u = k
m.q = k
j.z = k
j.v = l
j.w = i
b.u = l
b.q = l
g.u = k
g.q = j
l.z = j
l.v = k
l.w = i
assert l.w.x.u.w.x.txt == "b"