class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

m = A("m")
f = B("f")
n = C("n")
i = D("i")
a = E("a")
d = F("d")
h = E("h")

m.q = n
m.x = n
m.w = i
m.u = h
f.o = h
f.w = a
f.z = d
n.v = f
n.r = d
i.p = m
i.r = d
a.o = i
a.p = h
a.u = d
d.o = f
d.y = i
h.o = i
h.p = a
h.u = d
assert d.o.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: C = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

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

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

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

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

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

m = A("m")
f = B("f")
n = C("n")
i = D("i")
a = E("a")
d = F("d")
h = E("h")

m.q = n
m.x = n
m.w = i
m.u = h
f.o = h
f.w = a
f.z = d
n.v = f
n.r = d
i.p = m
i.r = d
a.o = i
a.p = h
a.u = d
d.o = f
d.y = i
h.o = i
h.p = a
h.u = d
assert d.o.o.u.txt == "d"