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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: D = None
        self.p: F = None
        self.y: B = None
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

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

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

k = A("k")
g = B("g")
i = C("i")
j = D("j")
c = E("c")
a = F("a")

k.s = i
k.z = c
g.s = i
g.q = k
i.x = j
i.z = j
i.v = j
i.p = a
i.y = g
i.t = g
j.q = a
j.x = k
c.r = a
c.o = i
a.v = g
assert i.p.v.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: D = None
        self.p: F = None
        self.y: B = None
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

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

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

k = A("k")
g = B("g")
i = C("i")
j = D("j")
c = E("c")
a = F("a")

k.s = i
k.z = c
g.s = i
g.q = k
i.x = j
i.z = j
i.v = j
i.p = a
i.y = g
i.t = g
j.q = a
j.x = k
c.r = a
c.o = i
a.v = g
assert i.p.v.q.z.txt == "c"