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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

h = A("h")
k = B("k")
b = C("b")
g = D("g")
d = E("d")
n = F("n")
l = B("l")
j = C("j")
m = C("m")

h.u = k
h.z = k
h.q = d
h.t = d
h.p = n
k.z = j
k.q = n
b.u = d
g.q = h
d.p = g
n.s = k
n.w = h
n.y = g
n.t = d
l.z = b
l.q = n
j.u = d
m.u = d
assert j.u.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.q: E = None
        self.t: E = None
        self.p: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

h = A("h")
k = B("k")
b = C("b")
g = D("g")
d = E("d")
n = F("n")
l = B("l")
j = C("j")
m = C("m")

h.u = k
h.z = k
h.q = d
h.t = d
h.p = n
k.z = j
k.q = n
b.u = d
g.q = h
d.p = g
n.s = k
n.w = h
n.y = g
n.t = d
l.z = b
l.q = n
j.u = d
m.u = d
assert j.u.p.q.txt == "h"