class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: B = None
        self.p: F = None
        self.o: C = None
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
n = C("n")
f = D("f")
m = E("m")
g = F("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
n = C("n")
f = D("f")
m = E("m")
g = F("g")

c.x = f
c.w = e
c.p = g
c.y = g
c.o = n
e.r = n
e.p = n
e.w = g
e.t = f
n.w = c
f.t = g
m.r = g
m.u = g
m.p = g
m.x = n
g.w = c
g.u = c
g.r = c
g.q = n
g.s = e
assert f.t.s.t.t.txt == "g"