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

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

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

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

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

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

n = A("n")
j = B("j")
a = C("a")
e = D("e")
c = E("c")
g = F("g")

n.o = a
n.x = a
n.r = a
n.w = e
j.r = a
j.t = c
j.s = n
a.z = g
a.s = g
a.y = e
a.r = e
a.p = j
a.u = j
e.s = a
e.p = j
c.p = a
g.q = e
g.t = a
g.s = a
g.o = j
g.r = c
g.p = c
assert g.t.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: C = None
        self.w: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

n = A("n")
j = B("j")
a = C("a")
e = D("e")
c = E("c")
g = F("g")

n.o = a
n.x = a
n.r = a
n.w = e
j.r = a
j.t = c
j.s = n
a.z = g
a.s = g
a.y = e
a.r = e
a.p = j
a.u = j
e.s = a
e.p = j
c.p = a
g.q = e
g.t = a
g.s = a
g.o = j
g.r = c
g.p = c
assert g.t.z.p.txt == "c"