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

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

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

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

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

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

j = A("j")
f = B("f")
a = C("a")
k = D("k")
h = E("h")
n = F("n")
g = D("g")

j.o = g
f.v = g
f.u = j
f.t = n
f.w = n
f.p = h
f.o = a
a.u = f
k.p = n
k.q = j
k.z = g
h.q = g
h.w = n
h.t = j
n.u = f
n.r = f
n.o = f
n.y = f
g.p = n
g.q = j
g.z = k
assert j.o.z.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.v: D = None
        self.u: A = None
        self.t: F = None
        self.w: F = None
        self.p: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

j = A("j")
f = B("f")
a = C("a")
k = D("k")
h = E("h")
n = F("n")
g = D("g")

j.o = g
f.v = g
f.u = j
f.t = n
f.w = n
f.p = h
f.o = a
a.u = f
k.p = n
k.q = j
k.z = g
h.q = g
h.w = n
h.t = j
n.u = f
n.r = f
n.o = f
n.y = f
g.p = n
g.q = j
g.z = k
assert j.o.z.p.o.txt == "f"