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

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

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

g = A("g")
i = B("i")
b = C("b")
j = C("j")
c = C("c")
l = C("l")
n = A("n")
a = C("a")
f = B("f")

g.q = f
g.v = b
i.t = f
i.r = f
i.y = f
b.z = a
b.u = g
b.v = i
j.z = l
j.u = g
j.v = i
c.z = b
c.u = g
c.v = i
l.z = j
l.u = n
l.v = i
n.q = i
n.v = b
a.z = l
a.u = n
a.v = i
f.t = i
f.r = i
f.y = i
assert g.q.r.r.y.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: C = None
        self.txt = txt

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

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

g = A("g")
i = B("i")
b = C("b")
j = C("j")
c = C("c")
l = C("l")
n = A("n")
a = C("a")
f = B("f")

g.q = f
g.v = b
i.t = f
i.r = f
i.y = f
b.z = a
b.u = g
b.v = i
j.z = l
j.u = g
j.v = i
c.z = b
c.u = g
c.v = i
l.z = j
l.u = n
l.v = i
n.q = i
n.v = b
a.z = l
a.u = n
a.v = i
f.t = i
f.r = i
f.y = i
assert g.q.r.r.y.r.y.txt == "i"