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

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

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

d = A("d")
m = B("m")
g = C("g")
j = A("j")
f = C("f")
k = B("k")
n = C("n")
c = A("c")

d.y = n
d.q = g
m.z = g
m.y = g
g.q = j
g.v = f
g.u = n
j.y = g
j.q = g
f.q = d
f.v = g
f.u = g
k.z = n
k.y = n
n.q = j
n.v = f
n.u = g
c.y = g
c.q = g
assert n.u.u.u.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: C = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
g = C("g")
j = A("j")
f = C("f")
k = B("k")
n = C("n")
c = A("c")

d.y = n
d.q = g
m.z = g
m.y = g
g.q = j
g.v = f
g.u = n
j.y = g
j.q = g
f.q = d
f.v = g
f.u = g
k.z = n
k.y = n
n.q = j
n.v = f
n.u = g
c.y = g
c.q = g
assert n.u.u.u.v.v.txt == "g"