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

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

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

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

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

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

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

a.r = n
a.y = h
a.z = k
a.s = k
a.p = j
a.x = f
f.p = k
f.r = h
f.u = j
j.v = f
j.x = n
j.s = a
h.s = k
h.t = j
n.v = a
n.u = j
n.z = f
k.o = a
k.x = a
k.v = a
k.u = f
assert k.x.x.p.u.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: D = None
        self.z: F = None
        self.p: C = None
        self.s: F = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

a.r = n
a.y = h
a.z = k
a.s = k
a.p = j
a.x = f
f.p = k
f.r = h
f.u = j
j.v = f
j.x = n
j.s = a
h.s = k
h.t = j
n.v = a
n.u = j
n.z = f
k.o = a
k.x = a
k.v = a
k.u = f
assert k.x.x.p.u.r.t.txt == "j"