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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.z: D = None
        self.o: F = None
        self.u: A = None
        self.t: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
b = C("b")
a = D("a")
f = E("f")
g = F("g")

k.x = f
n.r = b
n.s = b
n.o = k
b.s = k
b.o = f
a.w = b
f.w = n
f.x = b
f.t = b
f.z = a
f.o = g
f.u = k
g.v = n
g.r = f
g.q = f
g.z = b
g.t = k
assert g.v.o.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.z: D = None
        self.o: F = None
        self.u: A = None
        self.t: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
b = C("b")
a = D("a")
f = E("f")
g = F("g")

k.x = f
n.r = b
n.s = b
n.o = k
b.s = k
b.o = f
a.w = b
f.w = n
f.x = b
f.t = b
f.z = a
f.o = g
f.u = k
g.v = n
g.r = f
g.q = f
g.z = b
g.t = k
assert g.v.o.x.o.txt == "g"