class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: C = None
        self.y: F = None
        self.u: D = None
        self.q: C = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: A = None
        self.w: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: C = None
        self.r: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: A = None
        self.w: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: C = None
        self.r: D = None
        self.w: C = None
        self.txt = txt

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

n.w = f
n.o = a
n.q = a
n.y = h
n.u = d
n.r = j
f.q = d
f.r = h
a.q = f
a.t = d
d.y = a
d.t = f
j.z = a
j.r = n
j.w = f
j.x = f
h.x = n
h.z = a
h.w = a
h.r = d
assert d.t.q.t.q.t.r.txt == "h"