class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: F = None
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: A = None
        self.t: E = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

d = A("d")
b = B("b")
i = C("i")
l = D("l")
m = E("m")
k = F("k")
f = G("f")

d.r = f
d.z = k
d.u = l
b.z = d
b.v = d
b.q = d
b.t = m
i.v = m
i.q = m
l.o = d
m.x = f
m.v = k
m.p = d
m.r = b
k.x = l
k.s = b
k.q = d
k.y = m
f.p = b
assert f.p.t.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: F = None
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: A = None
        self.t: E = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

d = A("d")
b = B("b")
i = C("i")
l = D("l")
m = E("m")
k = F("k")
f = G("f")

d.r = f
d.z = k
d.u = l
b.z = d
b.v = d
b.q = d
b.t = m
i.v = m
i.q = m
l.o = d
m.x = f
m.v = k
m.p = d
m.r = b
k.x = l
k.s = b
k.q = d
k.y = m
f.p = b
assert f.p.t.p.z.txt == "k"