class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.y: D = None
        self.p: D = None
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: D = None
        self.v: B = None
        self.q: A = None
        self.txt = txt

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

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

l.w = h
l.o = m
l.y = n
l.p = n
l.z = n
j.s = l
j.p = l
j.q = c
j.u = k
c.p = n
c.s = h
c.x = l
c.u = m
n.o = j
n.s = b
n.q = b
n.r = k
n.u = m
m.y = j
m.v = j
m.o = b
m.q = l
h.p = c
h.r = j
b.o = j
b.s = n
b.q = n
b.r = h
b.u = m
k.p = c
k.r = j
assert m.q.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.y: D = None
        self.p: D = None
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: D = None
        self.v: B = None
        self.q: A = None
        self.txt = txt

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

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

l.w = h
l.o = m
l.y = n
l.p = n
l.z = n
j.s = l
j.p = l
j.q = c
j.u = k
c.p = n
c.s = h
c.x = l
c.u = m
n.o = j
n.s = b
n.q = b
n.r = k
n.u = m
m.y = j
m.v = j
m.o = b
m.q = l
h.p = c
h.r = j
b.o = j
b.s = n
b.q = n
b.r = h
b.u = m
k.p = c
k.r = j
assert m.q.p.r.txt == "k"