class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: C = None
        self.u: A = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.t: F = None
        self.w: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.r: B = None
        self.v: A = None
        self.x: A = None
        self.p: E = None
        self.txt = txt

m = A("m")
a = B("a")
c = C("c")
j = D("j")
f = E("f")
n = F("n")
i = D("i")
h = E("h")
k = A("k")

m.q = c
m.v = c
m.u = k
m.o = k
a.p = i
c.t = m
c.x = i
j.u = i
j.v = i
j.t = n
j.w = h
f.w = k
n.z = i
n.y = j
n.r = a
n.v = m
n.x = m
n.p = h
i.u = j
i.v = j
i.t = n
i.w = h
h.w = m
k.q = c
k.v = c
k.u = m
k.o = m
assert j.u.v.t.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: C = None
        self.u: A = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.t: F = None
        self.w: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.r: B = None
        self.v: A = None
        self.x: A = None
        self.p: E = None
        self.txt = txt

m = A("m")
a = B("a")
c = C("c")
j = D("j")
f = E("f")
n = F("n")
i = D("i")
h = E("h")
k = A("k")

m.q = c
m.v = c
m.u = k
m.o = k
a.p = i
c.t = m
c.x = i
j.u = i
j.v = i
j.t = n
j.w = h
f.w = k
n.z = i
n.y = j
n.r = a
n.v = m
n.x = m
n.p = h
i.u = j
i.v = j
i.t = n
i.w = h
h.w = m
k.q = c
k.v = c
k.u = m
k.o = m
assert j.u.v.t.p.w.txt == "m"