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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

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

c = A("c")
j = B("j")
g = C("g")
d = D("d")
h = E("h")
m = F("m")

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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

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

c = A("c")
j = B("j")
g = C("g")
d = D("d")
h = E("h")
m = F("m")

c.v = g
c.s = m
j.o = m
g.x = h
g.q = h
g.t = h
g.u = m
d.o = c
d.p = m
d.v = m
d.x = j
d.t = j
h.p = c
h.v = c
h.x = j
h.u = j
m.w = c
assert g.t.p.s.w.txt == "c"