class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: C = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.t: C = None
        self.q: D = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: E = None
        self.s: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: B = None
        self.v: D = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: E = None
        self.x: F = None
        self.z: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.t: C = None
        self.q: D = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: E = None
        self.s: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: B = None
        self.v: D = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: E = None
        self.x: F = None
        self.z: F = None
        self.txt = txt

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

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