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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: E = None
        self.x: E = None
        self.q: F = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.s: B = 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: D = None
        self.z: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: E = None
        self.x: E = None
        self.q: F = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.s: B = 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: D = None
        self.z: E = None
        self.txt = txt

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

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

a.o = m
k.p = h
k.x = h
k.u = j
k.q = d
k.v = g
m.r = a
m.s = k
g.u = m
h.p = g
h.z = j
d.t = h
d.o = h
d.p = k
d.v = a
d.z = m
i.o = m
j.p = g
j.z = h
assert j.p.u.s.txt == "k"