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

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

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

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

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

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

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

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

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

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

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

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

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

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

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