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

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

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

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

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

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

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

j.p = f
m.w = b
b.w = j
b.u = j
b.z = j
b.p = k
b.v = n
n.o = m
n.q = j
n.v = h
n.w = h
f.r = k
h.v = m
h.p = f
h.o = n
h.z = b
k.o = m
k.q = j
k.v = h
k.w = h
assert j.p.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

j.p = f
m.w = b
b.w = j
b.u = j
b.z = j
b.p = k
b.v = n
n.o = m
n.q = j
n.v = h
n.w = h
f.r = k
h.v = m
h.p = f
h.o = n
h.z = b
k.o = m
k.q = j
k.v = h
k.w = h
assert j.p.r.o.txt == "m"