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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.v: D = None
        self.u: E = None
        self.z: A = None
        self.x: C = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: G = None
        self.p: G = None
        self.o: F = None
        self.w: G = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: D = None
        self.r: C = None
        self.o: C = None
        self.y: D = None
        self.u: G = None
        self.txt = txt

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

k = A("k")
a = B("a")
m = C("m")
g = D("g")
i = E("i")
c = F("c")
f = G("f")

k.x = a
k.y = a
k.p = c
a.q = g
a.v = g
a.p = g
a.y = k
a.z = k
a.u = i
a.x = m
m.v = k
g.z = m
g.y = f
g.p = f
g.w = f
g.o = c
g.r = a
i.x = g
c.z = m
c.r = m
c.o = m
c.x = g
c.y = g
c.u = f
f.q = g
f.p = g
f.x = g
f.s = k
f.u = c
assert k.x.x.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: B = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.v: D = None
        self.u: E = None
        self.z: A = None
        self.x: C = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: G = None
        self.p: G = None
        self.o: F = None
        self.w: G = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: D = None
        self.r: C = None
        self.o: C = None
        self.y: D = None
        self.u: G = None
        self.txt = txt

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

k = A("k")
a = B("a")
m = C("m")
g = D("g")
i = E("i")
c = F("c")
f = G("f")

k.x = a
k.y = a
k.p = c
a.q = g
a.v = g
a.p = g
a.y = k
a.z = k
a.u = i
a.x = m
m.v = k
g.z = m
g.y = f
g.p = f
g.w = f
g.o = c
g.r = a
i.x = g
c.z = m
c.r = m
c.o = m
c.x = g
c.y = g
c.u = f
f.q = g
f.p = g
f.x = g
f.s = k
f.u = c
assert k.x.x.v.p.txt == "c"