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

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

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

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

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

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

l = A("l")
n = B("n")
d = C("d")
m = D("m")
e = E("e")
j = F("j")
b = E("b")
f = B("f")

l.o = m
n.r = f
n.o = l
n.q = j
n.y = m
n.p = b
d.p = j
d.x = j
d.s = f
d.z = f
m.p = l
e.z = m
e.r = j
e.q = j
e.y = n
e.p = n
e.s = l
j.u = l
j.z = l
j.s = m
j.w = m
j.p = f
j.r = d
b.z = m
b.r = j
b.q = j
b.y = n
b.p = n
b.s = l
f.r = n
f.o = l
f.q = j
f.y = m
f.p = e
assert j.p.p.p.p.s.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

l = A("l")
n = B("n")
d = C("d")
m = D("m")
e = E("e")
j = F("j")
b = E("b")
f = B("f")

l.o = m
n.r = f
n.o = l
n.q = j
n.y = m
n.p = b
d.p = j
d.x = j
d.s = f
d.z = f
m.p = l
e.z = m
e.r = j
e.q = j
e.y = n
e.p = n
e.s = l
j.u = l
j.z = l
j.s = m
j.w = m
j.p = f
j.r = d
b.z = m
b.r = j
b.q = j
b.y = n
b.p = n
b.s = l
f.r = n
f.o = l
f.q = j
f.y = m
f.p = e
assert j.p.p.p.p.s.o.p.o.txt == "m"