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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: C = None
        self.txt = txt

h = A("h")
g = B("g")
b = C("b")
k = D("k")
e = E("e")
j = F("j")
c = B("c")

h.w = b
h.o = e
h.t = k
h.u = k
h.v = j
h.x = c
g.w = c
b.t = g
k.y = b
k.u = h
k.t = g
k.p = g
k.z = j
k.s = e
e.o = j
j.y = e
j.o = b
c.w = g
assert c.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: E = None
        self.t: D = None
        self.v: F = None
        self.x: B = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: C = None
        self.txt = txt

h = A("h")
g = B("g")
b = C("b")
k = D("k")
e = E("e")
j = F("j")
c = B("c")

h.w = b
h.o = e
h.t = k
h.u = k
h.v = j
h.x = c
g.w = c
b.t = g
k.y = b
k.u = h
k.t = g
k.p = g
k.z = j
k.s = e
e.o = j
j.y = e
j.o = b
c.w = g
assert c.w.w.w.w.w.txt == "g"