class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: B = None
        self.t: B = None
        self.p: E = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.o: D = None
        self.x: D = None
        self.t: C = None
        self.s: D = None
        self.y: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

d.u = c
d.s = c
d.t = c
d.p = i
d.x = m
c.q = m
c.o = n
c.x = n
c.s = n
c.t = j
c.y = d
j.q = d
n.v = k
k.o = m
m.p = j
m.v = n
m.t = i
m.o = c
i.o = m
h.u = c
h.s = c
h.t = c
h.p = k
h.x = m
g.q = d
assert i.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: B = None
        self.t: B = None
        self.p: E = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.o: D = None
        self.x: D = None
        self.t: C = None
        self.s: D = None
        self.y: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

d.u = c
d.s = c
d.t = c
d.p = i
d.x = m
c.q = m
c.o = n
c.x = n
c.s = n
c.t = j
c.y = d
j.q = d
n.v = k
k.o = m
m.p = j
m.v = n
m.t = i
m.o = c
i.o = m
h.u = c
h.s = c
h.t = c
h.p = k
h.x = m
g.q = d
assert i.o.t.o.txt == "m"