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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: B = None
        self.x: B = None
        self.q: D = None
        self.v: C = None
        self.txt = txt

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

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

m.u = c
m.o = g
i.v = d
i.u = c
i.x = g
i.p = h
h.r = g
h.q = a
k.r = a
b.w = i
b.o = i
b.x = i
b.q = d
b.v = h
g.q = m
g.x = i
d.r = b
c.u = m
c.o = g
a.w = i
a.o = i
a.x = i
a.q = k
a.v = h
assert a.q.r.v.r.q.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: B = None
        self.x: B = None
        self.q: D = None
        self.v: C = None
        self.txt = txt

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

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

m.u = c
m.o = g
i.v = d
i.u = c
i.x = g
i.p = h
h.r = g
h.q = a
k.r = a
b.w = i
b.o = i
b.x = i
b.q = d
b.v = h
g.q = m
g.x = i
d.r = b
c.u = m
c.o = g
a.w = i
a.o = i
a.x = i
a.q = k
a.v = h
assert a.q.r.v.r.q.u.o.txt == "g"