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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: C = None
        self.r: A = None
        self.o: F = None
        self.w: C = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: C = None
        self.r: A = None
        self.o: F = None
        self.w: C = None
        self.p: E = None
        self.txt = txt

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

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

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

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