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

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

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

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

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

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

h = A("h")
a = B("a")
g = C("g")
j = D("j")
m = E("m")
n = F("n")
f = C("f")

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

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

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

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

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

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

h = A("h")
a = B("a")
g = C("g")
j = D("j")
m = E("m")
n = F("n")
f = C("f")

h.y = n
h.z = n
h.v = m
h.o = m
h.p = j
h.w = g
a.t = j
a.y = f
a.u = m
a.r = g
a.s = g
g.q = n
j.o = n
m.w = n
m.z = n
m.u = n
m.x = j
n.w = h
f.q = n
assert n.w.w.q.w.txt == "h"