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

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: F = None
        self.z: E = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.y: A = None
        self.r: C = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

a = A("a")
m = B("m")
k = C("k")
h = D("h")
j = E("j")
d = F("d")

a.o = j
a.v = k
m.u = a
m.o = h
k.t = d
k.y = d
k.u = d
k.z = j
h.u = k
j.p = m
j.v = m
j.z = m
j.y = a
j.r = k
d.u = a
assert d.u.o.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: F = None
        self.z: E = None
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.y: A = None
        self.r: C = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

a = A("a")
m = B("m")
k = C("k")
h = D("h")
j = E("j")
d = F("d")

a.o = j
a.v = k
m.u = a
m.o = h
k.t = d
k.y = d
k.u = d
k.z = j
h.u = k
j.p = m
j.v = m
j.z = m
j.y = a
j.r = k
d.u = a
assert d.u.o.r.z.txt == "j"