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

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

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

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

e = A("e")
j = B("j")
n = C("n")
m = D("m")
f = B("f")
i = C("i")
k = B("k")
g = B("g")
c = C("c")
b = A("b")

e.u = m
e.v = m
j.s = m
j.u = e
j.x = e
n.w = m
m.y = i
m.v = n
m.u = j
m.p = c
f.s = m
f.u = b
f.x = e
i.w = m
k.s = m
k.u = e
k.x = e
g.s = m
g.u = b
g.x = b
c.w = m
b.u = m
b.v = m
assert c.w.p.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
n = C("n")
m = D("m")
f = B("f")
i = C("i")
k = B("k")
g = B("g")
c = C("c")
b = A("b")

e.u = m
e.v = m
j.s = m
j.u = e
j.x = e
n.w = m
m.y = i
m.v = n
m.u = j
m.p = c
f.s = m
f.u = b
f.x = e
i.w = m
k.s = m
k.u = e
k.x = e
g.s = m
g.u = b
g.x = b
c.w = m
b.u = m
b.v = m
assert c.w.p.w.p.w.txt == "m"