class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: F = None
        self.t: C = None
        self.v: G = None
        self.x: D = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: A = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: G = None
        self.t: F = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: C = None
        self.t: C = None
        self.p: C = None
        self.o: A = None
        self.txt = txt

a = A("a")
f = B("f")
k = C("k")
l = D("l")
m = E("m")
g = F("g")
c = G("c")
j = B("j")

a.r = k
a.t = k
a.s = g
a.v = c
a.x = l
a.u = l
f.r = j
f.t = c
f.v = c
f.y = c
f.z = g
k.z = c
l.r = k
l.t = k
l.z = a
m.r = a
m.u = a
m.q = a
m.p = c
m.t = g
g.w = m
g.x = m
g.p = j
c.y = g
c.u = k
c.t = k
c.p = k
c.o = a
j.r = f
j.t = c
j.v = c
j.y = c
j.z = g
assert k.z.y.p.z.w.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: F = None
        self.t: C = None
        self.v: G = None
        self.x: D = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: A = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: G = None
        self.t: F = None
        self.u: A = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: C = None
        self.t: C = None
        self.p: C = None
        self.o: A = None
        self.txt = txt

a = A("a")
f = B("f")
k = C("k")
l = D("l")
m = E("m")
g = F("g")
c = G("c")
j = B("j")

a.r = k
a.t = k
a.s = g
a.v = c
a.x = l
a.u = l
f.r = j
f.t = c
f.v = c
f.y = c
f.z = g
k.z = c
l.r = k
l.t = k
l.z = a
m.r = a
m.u = a
m.q = a
m.p = c
m.t = g
g.w = m
g.x = m
g.p = j
c.y = g
c.u = k
c.t = k
c.p = k
c.o = a
j.r = f
j.t = c
j.v = c
j.y = c
j.z = g
assert k.z.y.p.z.w.p.y.txt == "g"