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

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

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

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

g.v = c
g.x = i
g.w = n
n.u = j
n.v = g
n.p = g
j.u = n
j.s = n
j.z = n
c.u = n
c.s = n
c.z = n
i.v = c
i.x = g
i.w = n
assert c.s.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: A = None
        self.w: B = None
        self.txt = txt

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

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

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

g.v = c
g.x = i
g.w = n
n.u = j
n.v = g
n.p = g
j.u = n
j.s = n
j.z = n
c.u = n
c.s = n
c.z = n
i.v = c
i.x = g
i.w = n
assert c.s.u.u.u.txt == "j"