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

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

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

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

c = A("c")
j = B("j")
m = C("m")
h = D("h")
l = A("l")
n = D("n")
i = B("i")
k = C("k")

c.y = k
c.o = l
c.x = m
j.y = i
j.w = l
j.u = m
m.v = l
m.p = l
h.v = n
h.y = n
l.y = m
l.x = m
l.o = c
n.v = h
n.y = h
i.y = j
i.w = c
i.u = m
k.v = l
k.p = l
assert m.p.o.o.x.p.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
m = C("m")
h = D("h")
l = A("l")
n = D("n")
i = B("i")
k = C("k")

c.y = k
c.o = l
c.x = m
j.y = i
j.w = l
j.u = m
m.v = l
m.p = l
h.v = n
h.y = n
l.y = m
l.x = m
l.o = c
n.v = h
n.y = h
i.y = j
i.w = c
i.u = m
k.v = l
k.p = l
assert m.p.o.o.x.p.o.x.txt == "m"