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

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

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

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

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

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

i = A("i")
g = B("g")
h = C("h")
m = D("m")
k = E("k")
j = F("j")

i.p = j
g.x = m
h.v = k
h.s = k
h.z = j
h.w = j
h.t = i
h.x = m
m.x = g
m.v = g
m.z = j
m.u = j
k.s = g
k.x = j
k.r = j
k.p = h
j.v = i
j.w = i
j.o = i
j.r = h
j.q = k
assert h.t.p.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

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

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

i = A("i")
g = B("g")
h = C("h")
m = D("m")
k = E("k")
j = F("j")

i.p = j
g.x = m
h.v = k
h.s = k
h.z = j
h.w = j
h.t = i
h.x = m
m.x = g
m.v = g
m.z = j
m.u = j
k.s = g
k.x = j
k.r = j
k.p = h
j.v = i
j.w = i
j.o = i
j.r = h
j.q = k
assert h.t.p.w.p.txt == "j"