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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: A = None
        self.y: C = None
        self.z: A = None
        self.txt = txt

l = A("l")
h = B("h")
j = C("j")
a = D("a")
n = E("n")
e = F("e")
b = B("b")

l.q = e
l.y = j
h.p = e
h.t = j
h.y = n
j.q = n
j.y = e
j.o = a
j.p = h
a.s = n
a.p = l
a.r = e
n.q = h
n.u = l
e.t = l
e.r = l
e.z = l
e.y = j
b.p = e
b.t = j
b.y = n
assert l.q.t.q.t.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: A = None
        self.y: C = None
        self.z: A = None
        self.txt = txt

l = A("l")
h = B("h")
j = C("j")
a = D("a")
n = E("n")
e = F("e")
b = B("b")

l.q = e
l.y = j
h.p = e
h.t = j
h.y = n
j.q = n
j.y = e
j.o = a
j.p = h
a.s = n
a.p = l
a.r = e
n.q = h
n.u = l
e.t = l
e.r = l
e.z = l
e.y = j
b.p = e
b.t = j
b.y = n
assert l.q.t.q.t.y.p.txt == "h"