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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: E = None
        self.p: B = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
k = C("k")
a = D("a")
b = E("b")
f = F("f")

j.p = k
j.o = k
j.u = k
e.w = j
e.u = a
e.v = k
k.y = b
k.o = b
k.p = e
a.t = f
a.w = k
b.p = a
b.u = k
b.w = k
b.z = j
f.t = e
assert e.w.p.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: C = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: E = None
        self.p: B = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
k = C("k")
a = D("a")
b = E("b")
f = F("f")

j.p = k
j.o = k
j.u = k
e.w = j
e.u = a
e.v = k
k.y = b
k.o = b
k.p = e
a.t = f
a.w = k
b.p = a
b.u = k
b.w = k
b.z = j
f.t = e
assert e.w.p.y.z.txt == "j"