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

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: D = None
        self.s: B = None
        self.p: C = None
        self.v: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: D = None
        self.s: B = None
        self.p: C = None
        self.v: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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