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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: E = None
        self.s: C = None
        self.w: D = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: C = None
        self.s: C = None
        self.v: C = None
        self.txt = txt

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

m.p = d
d.u = f
d.x = f
h.w = m
h.r = i
i.t = h
i.s = h
i.x = j
i.v = j
i.w = f
i.r = f
j.p = h
j.u = d
j.v = d
j.x = c
c.p = h
c.o = h
c.s = h
c.v = h
f.t = h
f.s = h
f.x = j
f.v = j
f.w = i
f.r = i
assert m.p.u.w.w.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: E = None
        self.s: C = None
        self.w: D = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: C = None
        self.s: C = None
        self.v: C = None
        self.txt = txt

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

m.p = d
d.u = f
d.x = f
h.w = m
h.r = i
i.t = h
i.s = h
i.x = j
i.v = j
i.w = f
i.r = f
j.p = h
j.u = d
j.v = d
j.x = c
c.p = h
c.o = h
c.s = h
c.v = h
f.t = h
f.s = h
f.x = j
f.v = j
f.w = i
f.r = i
assert m.p.u.w.w.v.v.txt == "d"