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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.r: B = None
        self.q: E = None
        self.z: F = None
        self.txt = txt

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

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

n = A("n")
m = B("m")
e = C("e")
b = D("b")
d = E("d")
f = F("f")
g = B("g")
h = F("h")
k = C("k")
l = A("l")

n.r = e
n.o = b
m.s = e
m.w = d
m.r = l
e.o = l
e.y = f
e.u = m
b.o = l
b.x = g
b.r = m
b.q = d
b.z = f
d.x = b
d.z = k
d.y = f
f.q = b
f.w = k
f.r = h
f.x = h
f.y = d
g.s = e
g.w = d
g.r = l
h.q = b
h.w = k
h.r = f
h.x = f
h.y = d
k.o = n
k.y = h
k.u = m
l.r = k
l.o = b
assert g.w.x.q.x.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.r: B = None
        self.q: E = None
        self.z: F = None
        self.txt = txt

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

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

n = A("n")
m = B("m")
e = C("e")
b = D("b")
d = E("d")
f = F("f")
g = B("g")
h = F("h")
k = C("k")
l = A("l")

n.r = e
n.o = b
m.s = e
m.w = d
m.r = l
e.o = l
e.y = f
e.u = m
b.o = l
b.x = g
b.r = m
b.q = d
b.z = f
d.x = b
d.z = k
d.y = f
f.q = b
f.w = k
f.r = h
f.x = h
f.y = d
g.s = e
g.w = d
g.r = l
h.q = b
h.w = k
h.r = f
h.x = f
h.y = d
k.o = n
k.y = h
k.u = m
l.r = k
l.o = b
assert g.w.x.q.x.o.o.txt == "b"