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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

f = A("f")
k = B("k")
c = C("c")
d = D("d")
e = E("e")
l = F("l")
j = G("j")

f.p = k
f.w = l
f.z = j
k.r = e
k.s = d
k.z = f
c.o = k
c.x = f
c.p = j
c.w = d
c.s = e
d.z = j
d.q = k
d.p = c
e.r = k
e.y = d
l.r = c
j.o = e
j.q = c
assert c.s.r.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: F = None
        self.z: G = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

f = A("f")
k = B("k")
c = C("c")
d = D("d")
e = E("e")
l = F("l")
j = G("j")

f.p = k
f.w = l
f.z = j
k.r = e
k.s = d
k.z = f
c.o = k
c.x = f
c.p = j
c.w = d
c.s = e
d.z = j
d.q = k
d.p = c
e.r = k
e.y = d
l.r = c
j.o = e
j.q = c
assert c.s.r.z.z.txt == "j"