class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: G = None
        self.q: C = None
        self.s: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.txt = txt

l = A("l")
k = B("k")
b = C("b")
e = D("e")
c = E("c")
n = F("n")
d = G("d")
m = D("m")

l.v = c
l.o = e
k.p = c
k.x = d
k.q = b
k.s = l
b.y = k
b.s = k
b.z = m
b.t = c
e.p = k
c.r = l
n.t = e
n.z = l
n.v = k
n.o = k
d.p = m
d.y = l
m.p = k
assert d.y.o.p.q.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: G = None
        self.q: C = None
        self.s: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: A = None
        self.txt = txt

l = A("l")
k = B("k")
b = C("b")
e = D("e")
c = E("c")
n = F("n")
d = G("d")
m = D("m")

l.v = c
l.o = e
k.p = c
k.x = d
k.q = b
k.s = l
b.y = k
b.s = k
b.z = m
b.t = c
e.p = k
c.r = l
n.t = e
n.z = l
n.v = k
n.o = k
d.p = m
d.y = l
m.p = k
assert d.y.o.p.q.z.p.txt == "k"