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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: F = None
        self.z: E = None
        self.p: C = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: C = None
        self.u: A = None
        self.q: A = None
        self.s: A = None
        self.y: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: F = None
        self.z: E = None
        self.p: C = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: C = None
        self.u: A = None
        self.q: A = None
        self.s: A = None
        self.y: F = None
        self.txt = txt

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

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

k.o = a
k.y = a
e.w = k
e.q = j
e.z = f
e.x = f
e.p = a
a.q = j
h.x = j
h.w = e
h.y = f
f.w = e
f.v = a
f.u = k
f.q = k
f.s = k
f.y = j
j.o = f
j.u = f
j.r = f
j.p = e
assert k.o.q.r.w.q.p.txt == "e"