class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: B = None
        self.r: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

j.p = a
j.r = a
j.z = a
j.w = n
n.w = h
f.o = j
f.u = e
f.t = e
f.w = h
a.z = j
a.s = j
a.q = j
h.r = j
h.p = j
h.w = f
h.t = e
e.x = a
e.t = f
assert j.w.w.t.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: B = None
        self.r: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

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