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

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

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

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

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

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

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

c.p = i
c.t = k
c.q = h
a.q = c
a.z = n
a.w = b
n.s = i
h.t = c
h.p = c
h.o = i
b.u = j
b.q = d
k.z = j
k.x = c
k.w = c
k.p = a
k.r = a
i.t = c
i.p = c
i.o = h
j.u = b
j.q = k
d.z = b
d.x = c
d.w = c
d.p = a
d.r = a
assert b.u.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

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

c.p = i
c.t = k
c.q = h
a.q = c
a.z = n
a.w = b
n.s = i
h.t = c
h.p = c
h.o = i
b.u = j
b.q = d
k.z = j
k.x = c
k.w = c
k.p = a
k.r = a
i.t = c
i.p = c
i.o = h
j.u = b
j.q = k
d.z = b
d.x = c
d.w = c
d.p = a
d.r = a
assert b.u.q.z.txt == "j"