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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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