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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: D = None
        self.x: E = None
        self.q: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: D = None
        self.txt = txt

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

h = A("h")
k = B("k")
g = C("g")
e = D("e")
d = E("d")
n = F("n")

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: D = None
        self.x: E = None
        self.q: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: D = None
        self.txt = txt

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

h = A("h")
k = B("k")
g = C("g")
e = D("e")
d = E("d")
n = F("n")

h.r = g
h.p = n
h.q = e
h.u = d
h.w = k
k.w = g
k.p = e
k.x = d
k.q = n
g.q = n
g.v = n
g.t = e
g.z = k
g.p = h
e.t = h
e.x = h
e.r = n
e.p = n
e.o = d
d.s = g
d.v = e
n.s = k
n.q = k
n.u = e
assert d.s.p.q.p.q.w.txt == "g"