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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: A = None
        self.z: E = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: A = None
        self.t: G = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: F = None
        self.y: B = None
        self.x: B = None
        self.r: D = None
        self.p: C = None
        self.txt = txt

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

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

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

g.o = l
g.z = l
g.y = a
a.p = k
a.q = k
a.y = l
a.u = l
a.r = l
l.x = n
l.r = g
l.z = k
l.u = k
l.o = c
c.p = k
c.x = g
c.t = h
c.v = a
k.o = n
k.w = n
k.y = a
k.x = a
k.r = c
k.p = l
n.t = c
n.y = a
f.z = g
f.v = h
h.z = g
h.v = f
assert a.p.r.p.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: A = None
        self.z: E = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: A = None
        self.t: G = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: F = None
        self.y: B = None
        self.x: B = None
        self.r: D = None
        self.p: C = None
        self.txt = txt

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

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

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

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