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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: F = None
        self.v: C = None
        self.t: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: F = None
        self.v: C = None
        self.t: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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