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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: F = None
        self.r: F = None
        self.t: A = 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: B = None
        self.w: A = None
        self.s: D = None
        self.t: C = None
        self.txt = txt

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

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

g.u = m
g.q = j
g.w = e
g.t = e
m.z = j
m.v = d
m.r = d
m.t = g
e.w = g
h.t = d
j.r = m
j.w = g
j.s = h
j.t = e
d.z = h
assert g.w.w.t.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: E = None
        self.w: C = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: F = None
        self.r: F = None
        self.t: A = 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: B = None
        self.w: A = None
        self.s: D = None
        self.t: C = None
        self.txt = txt

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

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

g.u = m
g.q = j
g.w = e
g.t = e
m.z = j
m.v = d
m.r = d
m.t = g
e.w = g
h.t = d
j.r = m
j.w = g
j.s = h
j.t = e
d.z = h
assert g.w.w.t.w.u.v.txt == "d"